Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
hedgieinsocks committed Nov 25, 2024
0 parents commit e6f4873
Show file tree
Hide file tree
Showing 7 changed files with 1,242 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: release

on:
push:
tags:
- "*"

jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: ncipollo/release-action@v1
# - uses: rajatjindal/krew-release-bot@v0.0.46
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Artyom Babiy

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
70 changes: 70 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
![kubectl-mdb project cover](img/cover.png)

# 🦭 kubectl-mdb

`kubectl-mdb` is a `kubectl` plugin that helps interact with [mariadb-operator](https://github.com/mariadb-operator) semi-sync replication clusters.

## Disclaimer

* This project is not affiliated with MariaDB Foundation or MariaDB Operator in any way.
* It has not been verified by MariaDB Operator, and no representations are made regarding the quality of the upstream software.
* Written for mariadb-operator `v0.36.0`

## Dependencies

* `jq` - https://github.com/jqlang/jq

Optionally, you can install the following tools to improve the output of some commands:

* `bat` - https://github.com/sharkdp/bat
* `yq` - https://github.com/kislyuk/yq

## Installation

Place `kubectl-mdb` into the directory within your `PATH` (e.g. `~/.local/bin` or `~/.krew/bin`)

## Customization

You can `export` the following variables to tweak the plugin's behaviour.

| VARIABLE | DEFAULT | DETAILS |
|-----------------------|--------------------------------|----------------------------------------------------------------------------|
| `KMDB_KUBECTL` | `kubectl` | kubectl binary name |
| `KMDB_NAMESPACE` | `default` | default k8s namespace |
| `KMDB_BACKUP_THREADS` | `1` | number of threads from `1` to `8` to use for parallel datafiles transfer |
| `KMDB_BACKUP_DIR` | `/var/lib/mysql/.kmdb_backup` | tmp directory in `/var/lib/mysql/` to accept backup stream |
| `KMDB_RESTORE_DIR` | `/var/lib/mysql/.kmdb_restore` | tmp directory in `/var/lib/mysql/` for restored backup |
| `KMDB_STREAM_PORT` | `4444` | default port from `1024` to `65535` for backup stream |

## Usage

```
kubectl mdb helps interact with mariadb-operator semi-sync replication clusters
Usage:
kubectl mdb <command> [<target>]
Commands:
ls [<mariadb>] list mariadbs with their pods
status <mariadb> check mariadb status
suspend <mariadb> pause mariadb reconciliation
unsuspend <mariadb> resume mariadb reconciliation
enter <pod> exec into pod
sql <pod> launch mariadb shell
proc <pod> print processlist
du <pod> calculate database disk usage
top [<pod>] display cpu and ram usage
repl <replica> check replication status
prom <replica> promote replica to primary
recreate <replica> recreate replica from primary
Flags:
-n, --namespace string set namespace scope
-v, --version show plugin version
-h, --help show this message
```

## Links

* https://mariadb.com/kb/en/setting-up-a-replica-with-mariabackup
* https://github.com/mariadb-operator/mariadb-operator/issues/141
Binary file added img/cover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit e6f4873

Please sign in to comment.