{"id":13693966,"url":"https://github.com/cybozu-go/moco","last_synced_at":"2026-05-12T11:01:26.649Z","repository":{"id":37764623,"uuid":"259216197","full_name":"cybozu-go/moco","owner":"cybozu-go","description":"MySQL operator on Kubernetes using GTID-based semi-synchronous replication.","archived":false,"fork":false,"pushed_at":"2025-05-13T01:51:55.000Z","size":21768,"stargazers_count":298,"open_issues_count":21,"forks_count":24,"subscribers_count":14,"default_branch":"main","last_synced_at":"2025-05-13T02:38:52.458Z","etag":null,"topics":["kubectl-plugins","kubernetes","kubernetes-operator","mysql"],"latest_commit_sha":null,"homepage":"https://cybozu-go.github.io/moco/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cybozu-go.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"docs/security.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-04-27T05:39:36.000Z","updated_at":"2025-05-13T01:51:57.000Z","dependencies_parsed_at":"2024-06-03T01:37:38.773Z","dependency_job_id":"958bd47b-265c-42bf-8a58-a3dbf14b3705","html_url":"https://github.com/cybozu-go/moco","commit_stats":null,"previous_names":["cybozu-go/myso"],"tags_count":81,"template":false,"template_full_name":"cybozu-go/neco-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cybozu-go%2Fmoco","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cybozu-go%2Fmoco/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cybozu-go%2Fmoco/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cybozu-go%2Fmoco/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cybozu-go","download_url":"https://codeload.github.com/cybozu-go/moco/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254478190,"owners_count":22077676,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["kubectl-plugins","kubernetes","kubernetes-operator","mysql"],"created_at":"2024-08-02T17:01:21.370Z","updated_at":"2026-05-12T11:01:26.640Z","avatar_url":"https://github.com/cybozu-go.png","language":"Go","funding_links":[],"categories":["Databases","Go"],"sub_categories":["MySQL"],"readme":"[![GitHub release](https://img.shields.io/github/release/cybozu-go/moco.svg?maxAge=60)][releases]\n[![CI](https://github.com/cybozu-go/moco/actions/workflows/ci.yaml/badge.svg)](https://github.com/cybozu-go/moco/actions/workflows/ci.yaml)\n[![PkgGoDev](https://pkg.go.dev/badge/github.com/cybozu-go/moco)](https://pkg.go.dev/github.com/cybozu-go/moco)\n[![Go Report Card](https://goreportcard.com/badge/github.com/cybozu-go/moco)](https://goreportcard.com/report/github.com/cybozu-go/moco)\n\n# MOCO\n\n\u003cimg src=\"./docs/logo.svg\" width=\"160\" alt=\"moco logo\" /\u003e\n\nMOCO is a [MySQL][] operator on Kubernetes.\nIts primary function is to manage MySQL clusters using [GTID-based](https://dev.mysql.com/doc/refman/8.0/en/replication-gtids.html) [semi-synchronous](https://dev.mysql.com/doc/refman/8.0/en/replication-semisync.html) replication.  It does _not_ manage [group replication](https://dev.mysql.com/doc/refman/8.0/en/group-replication.html) clusters.\n\nMOCO is designed to have the following properties.\n\n- Compatibility with the standard MySQL\n    - This is the reason that MOCO does not adopt group replication that has [a number of limitations](https://dev.mysql.com/doc/refman/8.0/en/group-replication-limitations.html).\n- Safety\n    - MOCO only allows writes to a single instance called the primary at a time.\n    - MOCO configures loss-less semi-synchronous replication with sufficient replicas.\n    - MOCO detects and excludes instances having [errant transactions](https://www.percona.com/blog/2014/05/19/errant-transactions-major-hurdle-for-gtid-based-failover-in-mysql-5-6/).\n- Availability\n    - MOCO can quickly switch the primary in case of the primary failure or restart.\n    - MOCO allows up to 5 instances in a cluster.\n\nBlog article: [Introducing MOCO, a modern MySQL operator on Kubernetes](https://blog.kintone.io/entry/moco)\n\n## Supported software\n\n- MySQL: 8.0.28, 8.0.43, 8.0.44, 8.0.45, 8.4.4, 8.4.8\n- Kubernetes: 1.33, 1.34, 1.35\n\nIf you use Kubernetes 1.35, using v1.35.4+ or disabling the `MaxUnavailableStatefulSet` feature gate is required ([kubernetes/kubernetes#137409](https://github.com/kubernetes/kubernetes/issues/137409)).\n\n\nMOCO supports (tests) the LTS releases of MySQL 8.\nInnovation releases would probably work. But they are not tested in our CI.\n\n## Features\n\n- Cluster with odd number of MySQL instances\n- [`kubectl` plugin](docs/kubectl-moco.md)\n- Replication from an external MySQL instance\n- Manual and automatic switchover of the primary instance\n- Automatic failover of the primary instance\n- Backup and [Point-in-Time Recovery](https://dev.mysql.com/doc/refman/8.0/en/point-in-time-recovery-positions.html)\n- Errant transaction detection\n- Different MySQL versions for each cluster\n- Upgrading MySQL version of a cluster\n- Monitor for replication delays\n- Built-in [mysqld_exporter][] for `mysqld` metrics\n- Services for the primary and replicas, respectively\n- Custom `my.cnf` configurations\n- Custom Pod, Service, and PersistentVolumeClaim templates\n- Redirect slow query logs to a sidecar container\n- Auto-generate [PodDisruptionBudget](https://kubernetes.io/docs/concepts/workloads/pods/disruptions/#pod-disruption-budgets)\n\n## Quick start\n\nYou can quickly run MOCO using [kind](https://kind.sigs.k8s.io/).\n\n1. Prepare a Linux machine and install Docker.\n2. Install aqua by following the instructions at https://aquaproj.github.io/docs/install/.\n3. Checkout MOCO and go to `e2e` directory.\n4. Run `make start`\n\nYou can then create a three-instance MySQL cluster as follows:\n\n```console\n$ cat \u003e mycluster.yaml \u003c\u003c'EOF'\napiVersion: moco.cybozu.com/v1beta2\nkind: MySQLCluster\nmetadata:\n  namespace: default\n  name: test\nspec:\n  replicas: 3\n  podTemplate:\n    spec:\n      containers:\n      - name: mysqld\n        image: ghcr.io/cybozu-go/moco/mysql:8.4.8\n  volumeClaimTemplates:\n  - metadata:\n      name: mysql-data\n    spec:\n      accessModes: [ \"ReadWriteOnce\" ]\n      resources:\n        requests:\n          storage: 1Gi\nEOF\n\n$ export KUBECONFIG=$(pwd)/.kubeconfig\n$ ../bin/kubectl apply -f mycluster.yaml\n```\n\nCheck the status of MySQLCluster until it becomes healthy as follows:\n\n```console\n$ ../bin/kubectl get mysqlcluster test\nNAME   AVAILABLE   HEALTHY   PRIMARY   SYNCED REPLICAS   ERRANT REPLICAS\ntest   True        True      0         3\n```\n\nOnce it becomes healthy, you can use `kubectl-moco` to play with `mysql` client.\n\n```console\n$ ../bin/kubectl moco mysql -it test\n```\n\nTo destroy the Kubernetes cluster, run:\n\n```console\n$ make stop\n```\n\n## Documentation\n\nSee https://cybozu-go.github.io/moco/\n\n[`examples`](examples/) directory contains example MySQLCluster manifests.\n\n## Contributing\n\nWe require all commits to comply with the [Developer Certificate of Origin](https://developercertificate.org/). Use `git commit -s` (or configure your Git client to add a `Signed-off-by` trailer) to sign off every commit before opening a pull request. Pull requests without the trailer will not pass our checks.\n\n## Docker images\n\nDocker images are available on [ghcr.io/cybozu-go/moco](https://github.com/orgs/cybozu-go/packages/container/package/moco).\n\n[releases]: https://github.com/cybozu-go/moco/releases\n[MySQL]: https://www.mysql.com/\n[mysqld_exporter]: https://github.com/prometheus/mysqld_exporter\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcybozu-go%2Fmoco","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcybozu-go%2Fmoco","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcybozu-go%2Fmoco/lists"}