Sign inSign up

sysc0d/mariadb-cluster

By sysc0d

•Updated over 9 years ago

Cluster MariaDB Galera

Image
1

561

sysc0d/mariadb-cluster repository overview

⁠HA Rancher Galera

Consider this a POC and not a production ready system!

Built for use with Docker 17.05.0-ce+ in Swarm Mode

⁠Setup Hosts

⁠Init Swarm Nodes/Cluster

Swarm Master:

docker swarm init
	

Additional Swarm Node(s):

docker swarm join <MasterNodeIP>:2377 + join-tokens shown at swarm init

To get the tokens at a later time, run docker swarm join-token (manager|worker)

⁠Create Rancher network
⁠Create custom ingress if not exist (for docker >= 17.05.0-ce)
docker network create -d overlay --ingress rancher-ingress
⁠Create custom network
    docker network create -d overlay --opt encrypted rancherntw

⁠Deploy app with Docker-compose

Docker Compose isn't required if you use swarm, if you need version 3 please show docker-compose documentation⁠

docker stack deploy --compose-file docker-compose.yml ha
docker service scale ha_dbcluster=3
docker service scale ha_rancher=2
⁠Verify cluster nodes
⁠Show services
docker stack services ha
ID                  NAME                MODE                REPLICAS            IMAGE                           PORTS
2rnkf52mmd7x        ha_rancher          replicated          2/2                 rancher/server:latest           *:8080->8080/tcp
ism0wiqtgrls        ha_dbcluster        replicated          3/3                 sysc0d/mariadb-cluster:latest
⁠Verify cluster DB
docker exec -it dbcluster.<RN>.<ID> mysql -u root -p -e "SHOW STATUS LIKE 'wsrep_cluster_size'"
+--------------------+-------+
| Variable_name      | Value |
+--------------------+-------+
| wsrep_cluster_size | 3     |
+--------------------+-------+

Tag summary

Content type

Image

Digest

Size

131.5 MB

Last updated

over 9 years ago

docker pull sysc0d/mariadb-cluster