https://github.com/hedgieinsocks/kubectl-mdba
🦭 kubectl plugin that helps manage mariadb-operator semi-sync replication clusters
https://github.com/hedgieinsocks/kubectl-mdba
bash kubectl kubectl-plugin mariadb mariadb-operator semi-sync
Last synced: 12 months ago
JSON representation
🦭 kubectl plugin that helps manage mariadb-operator semi-sync replication clusters
- Host: GitHub
- URL: https://github.com/hedgieinsocks/kubectl-mdba
- Owner: hedgieinsocks
- License: mit
- Created: 2024-11-25T13:05:55.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-07-22T13:31:44.000Z (about 1 year ago)
- Last Synced: 2025-07-22T15:25:04.922Z (about 1 year ago)
- Topics: bash, kubectl, kubectl-plugin, mariadb, mariadb-operator, semi-sync
- Language: Shell
- Homepage:
- Size: 77.1 KB
- Stars: 12
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

# 🦭 kubectl-mdba
`kubectl-mdba` (mariadb administrator) is a `kubectl` plugin that helps manage [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.38.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/mikefarah/yq (or https://github.com/kislyuk/yq)
## Installation
### Krew
```sh
❯ kubectl krew install mdba
```
### Manual
Place `kubectl-mdba` into the directory within your `$PATH` (e.g. `~/.local/bin`)
### Completion
Place `kubectl_complete-mdba` into the directory within your `$PATH` (e.g. `~/.local/bin`)
## Customization
You can `export` the following variables to tweak the plugin's behaviour.
| VARIABLE | DEFAULT | DETAILS |
|---------------------------------|--------------------------------|----------------------------------------------------------------------------|
| `KMDBA_KUBECTL` | `kubectl` | kubectl binary name |
| `KMDBA_NAMESPACE` | `default` | default k8s namespace |
| `KMDBA_RECREATE_STEP` | `1` | initial step number from `1` to `14` for replica recreation |
| `KMDBA_BACKUP_THREADS` | `1` | number of threads from `1` to `8` to use for parallel datafiles transfer |
| `KMDBA_STREAM_PORT` | `4444` | default port from `1024` to `65535` for backup stream |
| `KMDBA_IGNORE_PRIMARY_MISMATCH` | `0` | ignore mismatched desired and current primary pod indexes |
| `KMDBA_BACKUP_DIR` | `/var/lib/mysql/.kmdba_backup` | tmp directory in `/var/lib/mysql/` to accept backup stream |
| `KMDBA_RESTORE_DIR` | `/var/lib/mysql/.kmdba_restore` | tmp directory in `/var/lib/mysql/` for restored backup |
## Usage
```
kubectl mdba helps manage mariadb-operator semi-sync replication clusters
Usage:
kubectl mdba []
Commands:
ls [] list mariadbs with their pods
status check mariadb status
suspend pause mariadb reconciliation
unsuspend resume mariadb reconciliation
enter exec into pod
sql launch mariadb shell
proc print processlist
du calculate database disk usage
top [] display cpu and ram usage
repl check replication status
prom promote replica to primary
recreate recreate replica from primary
Flags:
-h, --help show this message
-v, --version show plugin version
-n, --namespace set namespace scope
Recreate Flags:
-f, --force ignore primary index mismatch
-p, --port port for backup stream (default: 4444)
-t, --threads parallel threads {1..8} for datafiles transfer (default: 1)
-s, --step step {1..14} to start from (default: 1)
```
## Links
* https://mariadb.com/kb/en/setting-up-a-replica-with-mariabackup
* https://github.com/mariadb-operator/mariadb-operator/issues/141