Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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: 4 days ago
JSON representation

🦭 kubectl plugin that helps manage mariadb-operator semi-sync replication clusters

Awesome Lists containing this project

README

        

![kubectl-mdba project cover](img/cover.png)

# 🦭 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.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/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/.kmdb_backup` | tmp directory in `/var/lib/mysql/` to accept backup stream |
| `KMDBA_RESTORE_DIR` | `/var/lib/mysql/.kmdb_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
-f, --force ignore primary index mismatch
-p, --port port for backup stream (default: 4444)
-t, --threads parallel threads for datafiles transfer (default: 1)
-s, --step recreate step 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