Created
January 29, 2021 09:28
-
-
Save potikanond/44cf1fb0720e81439f92a7a3e7fc3456 to your computer and use it in GitHub Desktop.
docker-compose file for Mariadb Cluster deployment using Galera
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.5' | |
services: | |
seed: | |
image: colinmollenhour/mariadb-galera-swarm:10.4.11-2020-01-06 | |
environment: | |
- XTRABACKUP_PASSWORD_FILE=/run/secrets/xtrabackup_password | |
- MYSQL_USER=dpotikan | |
- MYSQL_PASSWORD_FILE=/run/secrets/mysql_password | |
- MYSQL_DATABASE=database | |
- MYSQL_ROOT_PASSWORD_FILE=/run/secrets/mysql_root_password | |
- MYSQL_ROOT_HOST=% | |
- DEFAULT_TIME_ZONE=Asia/Bangkok | |
- TZ=Asia/Bangkok | |
- NODE_ADDRESS=^10.0.*.* | |
networks: | |
- dbnet | |
command: seed | |
volumes: | |
- mysql-data:/var/lib/mysql | |
secrets: | |
- xtrabackup_password | |
- mysql_password | |
- mysql_root_password | |
node: | |
image: colinmollenhour/mariadb-galera-swarm:10.4.11-2020-01-06 | |
environment: | |
- XTRABACKUP_PASSWORD_FILE=/run/secrets/xtrabackup_password | |
- NODE_ADDRESS=^10.0.*.* | |
- HEALTHY_WHILE_BOOTING=1 | |
- TZ=Asia/Bangkok | |
networks: | |
- dbnet | |
ports: | |
- 3306:3306 | |
command: node tasks.seed,tasks.node | |
volumes: | |
- mysql-data:/var/lib/mysql | |
deploy: | |
replicas: 0 | |
secrets: | |
- xtrabackup_password | |
volumes: | |
mysql-data: | |
name: '{{.Service.Name}}-{{.Task.Slot}}-data' | |
driver: local | |
networks: | |
dbnet: | |
driver: overlay | |
secrets: | |
xtrabackup_password: | |
external: true | |
mysql_password: | |
external: true | |
mysql_root_password: | |
external: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Start MariaDB Cluster node
Scale up the number of cluster node to 3
Run Maxscale as MariaDB load-balancer
Check MariaDB Cluster & Maxscale status