diff --git a/repl_manager.sh b/repl_manager.sh index 1ca3e7f091ccfe9f543e34bb8043e2276c3c03fb..bb7d9c4a391e3e05eac05feafac3e8ae79f66066 100755 --- a/repl_manager.sh +++ b/repl_manager.sh @@ -1,6 +1,7 @@ #!/bin/sh MASTERELECTION_NAME=${MASTERELECTION_NAME:-mariadb} +REPL_PASSWORD=${REPL_PASSWORD:-mariadb-replication} if [ -z "${PUBLIC_ADDR}" ]; then echo "ERROR: PUBLIC_ADDR is undefined" >&2 @@ -30,7 +31,7 @@ become_slave() { log "Switching master to ${master_addr}" - mysql -NBe "CHANGE MASTER TO MASTER_HOST='${master_host}' MASTER_PORT=${master_port} MASTER_USER='replication' MASTER_PASS='${REPL_PASSWORD}' MASTER_CONNECT_RETRY=10 MASTER_USE_GTID=current_pos MASTER_AUTO_POSITION=1; START SLAVE" + mysql -NBe "CHANGE MASTER TO MASTER_HOST='${master_host}', MASTER_PORT=${master_port}, MASTER_USER='replication', MASTER_PASSWORD='${REPL_PASSWORD}', MASTER_CONNECT_RETRY=10, MASTER_USE_GTID=current_pos, MASTER_AUTO_POSITION=1; START SLAVE" # TODO: Wait for replication to catch up. }