Git Product home page Git Product logo

mariadb-operator's Introduction

MariaDB-operator

Description

MariaDB Server is one of the most popular open source relational databases. It’s made by the original developers of MySQL. It is part of most cloud offerings and the default in most Linux distributions.

MariaDB-operator charm deploying and managing MariaDB on Kubernetes.

This charm has the following features:
- Add one more MariaDB units
- Config port of MariaDB
- Provide a database relation for any MariaDB client
- Allow to config the port mariadb will be listening on
- To restart mariadb service
- To backup database
- To list database backups
- To restore database from a specified backup

Usage

Deploying

$ git clone https://github.com/mullumaus/mariadb-operator
$ cd mariadb-operator
$ charmcraft pack
Created 'mariadb.charm'.
$juju deploy ./mariadb.charm --resource mariadb-image=mariadb

$ juju status
Model        Controller  Cloud/Region        Version  SLA          Timestamp
development  micro       microk8s/localhost  2.9.0    unsupported  20:52:16+10:00

App      Version  Status  Scale  Charm    Store  Channel  Rev  OS          Address  Message
mariadb  mariadb  active      1  mariadb  local            31  kubernetes           

Unit        Workload  Agent  Address     Ports  Message
mariadb/0*  active    idle   10.1.49.14    

Actions

Backup database

$ juju run-action mariadb/0 backup --wait
unit-mariadb-0:
UnitId: mariadb/0
id: "111"
results:
    message: backup /data/db/20210522-122411-backup.sql.gz
status: completed
timing:
    completed: 2021-05-22 12:24:12 +0000 UTC
    enqueued: 2021-05-22 12:24:12 +0000 UTC
    started: 2021-05-22 12:24:12 +0000 UTC

List database backups

$ juju run-action mariadb/0  --wait listbackup
unit-mariadb-0:
UnitId: mariadb/0
id: "115"
results:
    message: 'backup files: [''20210522-122245-backup.sql.gz'', ''20210522-122411-backup.sql.gz'']'
status: completed
timing:
    completed: 2021-05-22 12:24:31 +0000 UTC
    enqueued: 2021-05-22 12:24:28 +0000 UTC
    started: 2021-05-22 12:24:30 +0000 UTC

Restore backup

$ juju run-action mariadb/0  --wait restore
unit-mariadb-0:
UnitId: mariadb/0
id: "113"
results:
    message: restored /data/db/20210522-122411-backup.sql.gz
status: completed
timing:
    completed: 2021-05-22 12:24:21 +0000 UTC
    enqueued: 2021-05-22 12:24:19 +0000 UTC
    started: 2021-05-22 12:24:21 +0000 UTC

Developing

Create and activate a virtualenv with the development requirements:

virtualenv -p python3 venv
source venv/bin/activate
pip install -r requirements-dev.txt

Debugging

To check the logs generated by MariaDB

# The juju model in which MariaDB is installed corresponds to the k8s namespace
$ kubectl  get pods --namespace development
NAME                             READY   STATUS    RESTARTS   AGE
modeloperator-77b996d87b-hkj2t   1/1     Running   0          5h26m
mariadb-0                        2/2     Running   0          21m
$kubectl logs mariadb-0 -c mariadb

Testing

The Python operator framework includes a very nice harness for testing operator behaviour without full deployment. Just run_tests:

./run_tests

OCI Image source

https://hub.docker.com/_/mariadb

Roadmap

The MariaDB Charm is still a work in progress.

Here are some of the future features:

  • Allow to backup/restore database
  • Use keystone for authentication
  • Use hacluster for HA

mariadb-operator's People

Stargazers

Dan Ackerson avatar

Watchers

Lihui Guo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.