Git Product home page Git Product logo

cybozu-moco's Introduction

GitHub release CI PkgGoDev Go Report Card

MOCO

moco logo

MOCO is a MySQL operator on Kubernetes. Its primary function is to manage MySQL clusters using GTID-based semi-synchronous replication. It does not manage group replication clusters.

MOCO is designed to have the following properties.

  • Compatibility with the standard MySQL
  • Safety
    • MOCO only allows writes to a single instance called the primary at a time.
    • MOCO configures loss-less semi-synchronous replication with sufficient replicas.
    • MOCO detects and excludes instances having errant transactions.
  • Availability
    • MOCO can quickly switch the primary in case of the primary failure or restart.
    • MOCO allows up to 5 instances in a cluster.

Blog article: Introducing MOCO, a modern MySQL operator on Kubernetes

Supported software

  • MySQL: 8.0.18, 8.0.25, 8.0.26, 8.0.27, 8.0.28, 8.0.30, 8.0.31, 8.0.32, 8.0.33, 8.0.34, 8.0.35
  • Kubernetes: 1.25, 1.26, 1.27

MOCO supports (tests) the LTS releases of MySQL 8. Innovation releases would probably work. But they are not tested in our CI.

Features

  • Cluster with odd number of MySQL instances
  • kubectl plugin
  • Replication from an external MySQL instance
  • Manual and automatic switchover of the primary instance
  • Automatic failover of the primary instance
  • Backup and Point-in-Time Recovery
  • Errant transaction detection
  • Different MySQL versions for each cluster
  • Upgrading MySQL version of a cluster
  • Monitor for replication delays
  • Built-in mysqld_exporter for mysqld metrics
  • Services for the primary and replicas, respectively
  • Custom my.cnf configurations
  • Custom Pod, Service, and PersistentVolumeClaim templates
  • Redirect slow query logs to a sidecar container
  • Auto-generate PodDisruptionBudget

Quick start

You can quickly run MOCO using kind.

  1. Prepare a Linux machine and install Docker.
  2. Checkout MOCO and go to e2e directory.
  3. Run make start

You can then create a three-instance MySQL cluster as follows:

$ cat > mycluster.yaml <<'EOF'
apiVersion: moco.cybozu.com/v1beta2
kind: MySQLCluster
metadata:
  namespace: default
  name: test
spec:
  replicas: 3
  podTemplate:
    spec:
      containers:
      - name: mysqld
        image: ghcr.io/cybozu-go/moco/mysql:8.0.35
  volumeClaimTemplates:
  - metadata:
      name: mysql-data
    spec:
      accessModes: [ "ReadWriteOnce" ]
      resources:
        requests:
          storage: 1Gi
EOF

$ export KUBECONFIG=$(pwd)/.kubeconfig
$ ../bin/kubectl apply -f mycluster.yaml

Check the status of MySQLCluster until it becomes healthy as follows:

$ ../bin/kubectl get mysqlcluster test
NAME   AVAILABLE   HEALTHY   PRIMARY   SYNCED REPLICAS   ERRANT REPLICAS
test   True        True      0         3

Once it becomes healthy, you can use kubectl-moco to play with mysql client.

$ ../bin/kubectl moco mysql -it test

To destroy the Kubernetes cluster, run:

$ make stop

Documentation

See https://cybozu-go.github.io/moco/

examples directory contains example MySQLCluster manifests.

Docker images

Docker images are available on ghcr.io/cybozu-go/moco.

cybozu-moco's People

Contributors

masa213f avatar kfyharukz avatar ymmt2005 avatar d-kuro avatar zoetrope avatar ysksuzuki avatar yamatcha avatar umezawatakeshi avatar morimoto-cybozu avatar kmdkuk avatar yokaze avatar tapih avatar takara9 avatar entooone avatar dulltz avatar shunki-fujita avatar tomocy avatar vsliouniaev avatar binoue avatar dependabot[bot] avatar arosh avatar inductor avatar llamerada-jp avatar yoheinbb avatar jelmer avatar satoru-takeuchi avatar pddg avatar npdgm avatar yz775 avatar bells17 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.