change from repl to async
This commit is contained in:
parent
466f345f64
commit
bc5aba3268
2 changed files with 26 additions and 22 deletions
|
|
@ -9,26 +9,31 @@ services:
|
||||||
- MARIADB_USER=${DB_ADMIN_USER}
|
- MARIADB_USER=${DB_ADMIN_USER}
|
||||||
- MARIADB_PASSWORD=${DB_ADMIN_PASSWORD}
|
- MARIADB_PASSWORD=${DB_ADMIN_PASSWORD}
|
||||||
- MARIADB_DATABASE=initial_db
|
- MARIADB_DATABASE=initial_db
|
||||||
- SST_PASSWORD=${SST_PASSWORD}
|
# Pass these through for the init script
|
||||||
|
- APP_REGISTRY=${APP_REGISTRY}
|
||||||
|
- REPL_USER=${REPL_USER}
|
||||||
|
- REPL_PASSWORD=${REPL_PASSWORD}
|
||||||
|
# Dynamic password variables for your apps
|
||||||
|
- FORGEJO_DB_PASS=${FORGEJO_DB_PASS}
|
||||||
|
- GUACAMOLE_DB_PASS=${GUACAMOLE_DB_PASS}
|
||||||
|
- GRAFANA_DB_PASS=${GRAFANA_DB_PASS}
|
||||||
volumes:
|
volumes:
|
||||||
- /docker/maria/data:/var/lib/mysql
|
- /docker/maria/data:/var/lib/mysql
|
||||||
- /docker/maria/conf:/etc/mysql/conf.d
|
- /docker/maria/conf:/etc/mysql/conf.d
|
||||||
- /docker/maria/init:/docker-entrypoint-initdb.d
|
- /docker/maria/init:/docker-entrypoint-initdb.d
|
||||||
command:
|
command:
|
||||||
- mariadbd
|
- mariadbd
|
||||||
- --${WS_NEW_CLUSTER}
|
# NETWORK BINDING
|
||||||
- --wsrep-on=ON
|
|
||||||
- --wsrep-provider=/usr/lib/galera/libgalera_smm.so
|
|
||||||
- --wsrep-cluster-name=${CLUSTER_NAME}
|
|
||||||
- --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
|
- --bind-address=0.0.0.0
|
||||||
# Switch to MariaBackup (The production standard)
|
# ASYNC REPLICATION CONFIG
|
||||||
- --wsrep-sst-method=mariabackup
|
- --log-bin=mysql-bin
|
||||||
- --wsrep-sst-auth=sstuser:${SST_PASSWORD}
|
- --binlog-format=ROW
|
||||||
# Weight 2 on Node 1 forces it to be the leader during reboots/resets
|
- --server-id=${MGDB_NODE_NUMBER}
|
||||||
- --wsrep-provider-options=pc.ignore_sb=true;pc.npvo=true;pc.weight=${MARIA_PC_WEIGHT};pc.bootstrap=true
|
- --log-slave-updates=ON
|
||||||
|
- --gtid-strict-mode=ON
|
||||||
|
# COLLISION PREVENTION (Odds vs Evens)
|
||||||
|
- --auto-increment-increment=2
|
||||||
|
- --auto-increment-offset=${MGDB_NODE_NUMBER}
|
||||||
|
# PERFORMANCE
|
||||||
|
- --innodb-buffer-pool-size=1G # Adjust based on your RAM
|
||||||
|
- --innodb-flush-log-at-trx-commit=2 # 1=Safest, 2=Faster
|
||||||
|
|
@ -32,11 +32,10 @@ done
|
||||||
echo "All slots provisioned. Flushing privileges..."
|
echo "All slots provisioned. Flushing privileges..."
|
||||||
mariadb -u root -p"${M_ROOT_PASS}" -e "FLUSH PRIVILEGES;"
|
mariadb -u root -p"${M_ROOT_PASS}" -e "FLUSH PRIVILEGES;"
|
||||||
|
|
||||||
# Add this inside your 01_deploy_mgdb_dbs.sh script
|
echo "Creating Replication User..."
|
||||||
# (either in the loop or as a standalone block at the bottom)
|
mariadb -u root -p"${MARIADB_ROOT_PASSWORD}" <<-EOSQL
|
||||||
|
-- Create the replicator user allowing access from anywhere (or specify IPs)
|
||||||
mariadb -u root -p"${M_ROOT_PASS}" <<-EOSQL
|
CREATE USER IF NOT EXISTS '${REPL_USER}'@'%' IDENTIFIED BY '${REPL_PASSWORD}';
|
||||||
CREATE USER IF NOT EXISTS 'sstuser'@'localhost' IDENTIFIED BY '${SST_PASSWORD}';
|
GRANT REPLICATION SLAVE ON *.* TO '${REPL_USER}'@'%';
|
||||||
GRANT RELOAD, PROCESS, LOCK TABLES, REPLICATION CLIENT ON *.* TO 'sstuser'@'localhost';
|
|
||||||
FLUSH PRIVILEGES;
|
FLUSH PRIVILEGES;
|
||||||
EOSQL
|
EOSQL
|
||||||
Loading…
Reference in a new issue