|
|
@ -1,82 +1,73 @@ |
|
|
|
version: '3.4' |
|
|
|
version: '3.8' |
|
|
|
|
|
|
|
services: |
|
|
|
# seed: |
|
|
|
# image: colinmollenhour/mariadb-galera-swarm |
|
|
|
# environment: |
|
|
|
# - XTRABACKUP_PASSWORD_FILE=/run/secrets/xtrabackup_password |
|
|
|
# - MYSQL_USER=user |
|
|
|
# - MYSQL_PASSWORD_FILE=/run/secrets/mysql_password |
|
|
|
# - MYSQL_DATABASE=database |
|
|
|
# - MYSQL_ROOT_PASSWORD_FILE=/run/secrets/mysql_root_password |
|
|
|
# - NODE_ADDRESS=^10.0.*.* |
|
|
|
# networks: |
|
|
|
# - galera_network |
|
|
|
# command: seed |
|
|
|
# deploy: |
|
|
|
# placement: |
|
|
|
# # Services must run only on workers with one service per container |
|
|
|
# constraints: |
|
|
|
# - node.labels.node1 == true |
|
|
|
# - node.role == worker |
|
|
|
# volumes: |
|
|
|
# - /var/lib/mysql:/var/lib/mysql |
|
|
|
# secrets: |
|
|
|
# - xtrabackup_password |
|
|
|
# - mysql_password |
|
|
|
# - mysql_root_password |
|
|
|
anode: |
|
|
|
image: colinmollenhour/mariadb-galera-swarm |
|
|
|
# hostname: |
|
|
|
environment: |
|
|
|
- XTRABACKUP_PASSWORD_FILE=/run/secrets/xtrabackup_password |
|
|
|
- NODE_ADDRESS=^10.0.*.* |
|
|
|
- MYSQL_USER=user |
|
|
|
- MYSQL_PASSWORD_FILE=/run/secrets/mysql_password |
|
|
|
- MYSQL_DATABASE=database |
|
|
|
- MYSQL_ROOT_PASSWORD_FILE=/run/secrets/mysql_root_password |
|
|
|
- NODE_ADDRESS=^10.0.10.* |
|
|
|
- HEALTHY_WHILE_BOOTING=1 |
|
|
|
networks: |
|
|
|
- galera_network |
|
|
|
- mariadb |
|
|
|
ports: |
|
|
|
- mode: host |
|
|
|
target: 4567 |
|
|
|
published: 4567 |
|
|
|
command: node tasks.anode,tasks.bnode |
|
|
|
volumes: |
|
|
|
- /var/lib/mysql:/var/lib/mysql |
|
|
|
deploy: |
|
|
|
resources: |
|
|
|
limits: |
|
|
|
cpus: '0.75' |
|
|
|
memory: 250M |
|
|
|
reservations: |
|
|
|
cpus: '0.5' |
|
|
|
memory: 100M |
|
|
|
# Replicated mode |
|
|
|
mode: replicated |
|
|
|
replicas: 1 |
|
|
|
# restart_policy: |
|
|
|
# delay: 10s |
|
|
|
# max_attempts: 10 |
|
|
|
# window: 60s |
|
|
|
placement: |
|
|
|
# Services must run only on workers with one service per container |
|
|
|
#max_replicas_per_node: 1 |
|
|
|
max_replicas_per_node: 1 |
|
|
|
constraints: |
|
|
|
- node.labels.node1 == true |
|
|
|
- node.role == worker |
|
|
|
secrets: |
|
|
|
- xtrabackup_password |
|
|
|
- mysql_password |
|
|
|
- mysql_root_password |
|
|
|
bnode: |
|
|
|
image: colinmollenhour/mariadb-galera-swarm |
|
|
|
#hostname: bnode |
|
|
|
environment: |
|
|
|
- XTRABACKUP_PASSWORD_FILE=/run/secrets/xtrabackup_password |
|
|
|
- NODE_ADDRESS=^10.0.*.* |
|
|
|
- NODE_ADDRESS=^10.0.10.* |
|
|
|
- HEALTHY_WHILE_BOOTING=1 |
|
|
|
- MASTER_ADDR |
|
|
|
networks: |
|
|
|
- galera_network |
|
|
|
- mariadb |
|
|
|
command: node $MASTER_ADDR,tasks.bnode |
|
|
|
# command: node tasks.anode,tasks.bnode |
|
|
|
volumes: |
|
|
|
- /var/lib/mysql:/var/lib/mysql |
|
|
|
deploy: |
|
|
|
resources: |
|
|
|
limits: |
|
|
|
cpus: '0.75' |
|
|
|
memory: 250M |
|
|
|
reservations: |
|
|
|
cpus: '0.5' |
|
|
|
memory: 100M |
|
|
|
# Replicated mode |
|
|
|
mode: replicated |
|
|
|
replicas: 0 |
|
|
|
# restart_policy: |
|
|
|
# delay: 10s |
|
|
|
# max_attempts: 10 |
|
|
|
# window: 60s |
|
|
|
replicas: 1 |
|
|
|
placement: |
|
|
|
# Services must run only on workers with one service per container |
|
|
|
#max_replicas_per_node: 1 |
|
|
|
max_replicas_per_node: 1 |
|
|
|
constraints: |
|
|
|
- node.labels.node2 == true |
|
|
|
- node.role == worker |
|
|
@ -91,7 +82,9 @@ services: |
|
|
|
# driver: local |
|
|
|
|
|
|
|
networks: |
|
|
|
galera_network: |
|
|
|
mariadb: |
|
|
|
external: |
|
|
|
name: mariadb |
|
|
|
|
|
|
|
secrets: |
|
|
|
xtrabackup_password: |
|
|
|