Giter Site home page Giter Site logo

k8s-mysql-group-replication's Introduction

This repo is DEPRECATED

Please use official MySQL operator instead --> https://github.com/oracle/mysql-operator

k8s-mysql-group-replication

PoC for setting up MySQL Group Replication in Master-Master mode on Kubernetes

This work is based on K8s Statefull Sets documentation [https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/]

Requirements

  • PersistentVolume provisioner with a default StorageClass (or statically provisioned PersistentVolumes)
  • Kubernetes Cluster v 1.9 (StatefulSets are stable (GA) in 1.9)

Deployment and scaling

# kubectl apply -f *.yaml

# kubectl get pods
NAME      READY     STATUS    RESTARTS   AGE
mysql-0   2/2       Running   0          10s
# kubectl scale statefulset --replicas=3 mysql
# kubectl get pods
NAME      READY     STATUS    RESTARTS   AGE
mysql-0   2/2       Running   0          10m
mysql-1   2/2       Running   0          5md
mysql-2   0/2       Pending   0          14s
# kubectl -n mysql-test exec -ti mysql-0 mysql -- mysql -e'select * from performance_schema.replication_group_members;'
Defaulting container name to mysql.
Use 'kubectl describe pod/mysql-0 -n mysql-test' to see all of the containers in this pod.
+---------------------------+--------------------------------------+---------------+-------------+--------------+
| CHANNEL_NAME              | MEMBER_ID                            | MEMBER_HOST   | MEMBER_PORT | MEMBER_STATE |
+---------------------------+--------------------------------------+---------------+-------------+--------------+
| group_replication_applier | 14d265ce-e714-11e7-83eb-2a28a3915e90 | mysql-0.mysql |        3306 | ONLINE       |
| group_replication_applier | 331149cf-e714-11e7-999d-ea83a38cf6a7 | mysql-1.mysql |        3306 | ONLINE       |
| group_replication_applier | c9d9f4a8-ebd1-11e7-afe2-0e373b025b47 | mysql-2.mysql |        3306 | ONLINE       |
+---------------------------+--------------------------------------+---------------+-------------+--------------+

Future work

  • scripts cleanup
  • integrate with ProxySQL

k8s-mysql-group-replication's People

Contributors

gites 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.