Skip to content

Instantly share code, notes, and snippets.

@lucidfrontier45
Last active May 17, 2024 13:15
Show Gist options
  • Save lucidfrontier45/497341c4b848dfbd6dfb to your computer and use it in GitHub Desktop.
Save lucidfrontier45/497341c4b848dfbd6dfb to your computer and use it in GitHub Desktop.
docker-compose file for mariadb galera cluster
node1:
image: hauptmedia/mariadb:10.1
hostname: node1
ports:
- 13306:3306
environment:
- MYSQL_ROOT_PASSWORD=test
- REPLICATION_PASSWORD=test
- MYSQL_DATABASE=maria
- MYSQL_USER=maria
- MYSQL_PASSWORD=test
- GALERA=On
- NODE_NAME=node1
- CLUSTER_NAME=maria_cluster
- CLUSTER_ADDRESS=gcomm://
command: --wsrep-new-cluster
node2:
image: hauptmedia/mariadb:10.1
hostname: node2
links:
- node1
ports:
- 23306:3306
environment:
- REPLICATION_PASSWORD=test
- GALERA=On
- NODE_NAME=node2
- CLUSTER_NAME=maria_cluster
- CLUSTER_ADDRESS=gcomm://node1
node3:
image: hauptmedia/mariadb:10.1
hostname: node3
links:
- node1
ports:
- 33306:3306
environment:
- REPLICATION_PASSWORD=test
- GALERA=On
- NODE_NAME=node3
- CLUSTER_NAME=maria_cluster
- CLUSTER_ADDRESS=gcomm://node1
@fabiomontefuscolo
Copy link

fabiomontefuscolo commented Nov 8, 2016

It is aweome! I could test galera without edit mysql files. But I have a doubt, if I stop the node1, insert some records and then start node1 again, we will have a desync for this node. Do you know how to solve this?

@mluczak
Copy link

mluczak commented Sep 11, 2018

You need to restart node1 without --wsrep-new-cluster or it will create a new standalone single node cluster.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment