mapletree/lxc1/p0-infrastructure/mgdb.yml
2026-02-03 06:46:16 -07:00

30 lines
No EOL
1.2 KiB
YAML

services:
mariadb:
image: mariadb:11.4
container_name: mariadb-node${MGDB_NODE_NUMBER}
restart: always
network_mode: host
environment:
- MARIADB_ROOT_PASSWORD=${DB_ROOT_PASSWORD}
- MARIADB_USER=${DB_ADMIN_USER}
- MARIADB_PASSWORD=${DB_ADMIN_PASSWORD}
- MARIADB_DATABASE=initial_db
volumes:
- /docker/maria/data:/var/lib/mysql
- /docker/maria/conf:/etc/mysql/conf.d
command:
- --${WS_NEW_CLUSTER}
- --wsrep-on=ON
- --wsrep-provider=/usr/lib/galera/libgalera_smm.so
- --wsrep-cluster-name=${CLUSTER_NAME}
# The ?pc.wait_prim=no flag allows the service to start even if it can't find a primary yet
- --wsrep-cluster-address=gcomm://${CLUSTER_LOCAL_IP},${CLUSTER_REMOTE_IP}?pc.wait_prim=no
- --wsrep-node-address=${CLUSTER_KEEPALIVED_IP}
- --wsrep-node-name=node${MGDB_NODE_NUMBER}
- --binlog-format=row
- --default-storage-engine=innodb
- --innodb-autoinc-lock-mode=2
- --bind-address=0.0.0.0
# This is the "Zero-Management" fix:
# pc.ignore_sb=true allows a node to promote itself if its partner is missing.
- --wsrep-provider-options=pc.ignore_sb=true;pc.ignore_connection_expiry=true;pc.npvo=true