@@ -42,18 +42,11 @@ die()
4242}
4343trap " killoff" EXIT
4444
45- if docker run --rm " $image " mariadb --version 2> /dev/null
46- then
47- mariadb=mariadb
48- RPL_MONITOR=" REPLICA MONITOR"
49- v=$( docker run --rm " $image " mariadb --version)
50- if [[ $v =~ Distrib\ 10.4 ]]; then
51- # the new age hasn't begun yet
52- RPL_MONITOR=" REPLICATION CLIENT"
53- fi
54- else
55- # still running 10.3
56- mariadb=mysql
45+ mariadb=mariadb
46+ RPL_MONITOR=" REPLICA MONITOR"
47+ v=$( docker run --rm " $image " mariadb --version)
48+ if [[ $v =~ Distrib\ 10.4 ]]; then
49+ # the new age hasn't begun yet
5750 RPL_MONITOR=" REPLICATION CLIENT"
5851fi
5952
685678 -e MARIADB_USER=bob \
686679 -e MARIADB_PASSWORD=roger \
687680 -e MARIADB_DATABASE=rabbit \
681+ -e MARIADB_REPLICATION_USER=" repluser" \
682+ -e MARIADB_REPLICATION_PASSWORD=" replpassword" \
688683 " ${image} " --log-bin --log-basename=my-mariadb
689684 readarray -t vals < <( mariadbclient -u root --batch --skip-column-names -e ' show master status\G' )
690685 lastfile=" ${vals[1]} "
706701 -d \
707702 --rm \
708703 --name " $cname " \
709- -e MASTER_HOST=" $master_host " \
704+ -e MARIADB_MASTER_HOST=" $master_host " \
705+ -e MARIADB_REPLICATION_USER=" repluser" \
706+ -e MARIADB_REPLICATION_PASSWORD=" replpassword" \
710707 -e MARIADB_RANDOM_ROOT_PASSWORD=1 \
711- -e MARIADB_MYSQL_LOCALHOST_USER=1 \
712- -e MARIADB_MYSQL_LOCALHOST_GRANTS=" REPLICATION CLIENT /*!100509 ,REPLICA MONITOR */" \
713- -v " ${dir} " /replica-initdb.d/:/docker-entrypoint-initdb.d:Z \
708+ -e MARIADB_HEALTHCHECK_GRANTS=" ${RPL_MONITOR} " \
714709 --network=container:" $master_host " \
715- --health-cmd=' healthcheck.sh --su-mysql -- replication_io --replication_sql --replication_seconds_behind_master=0 --replication' \
710+ --health-cmd=' healthcheck.sh --replication_io --replication_sql --replication_seconds_behind_master=0 --replication' \
716711 --health-interval=3s \
717712 " $image " --server-id=2 --port 3307)
718713
719714 c=" ${DOCKER_LIBRARY_START_TIMEOUT:- 10} "
720- until docker exec " $cid " healthcheck.sh --su-mysql -- connect --replication_io --replication_sql --replication_seconds_behind_master=0 --replication || [ " $c " -eq 0 ]
715+ until docker exec " $cid " healthcheck.sh --connect --replication_io --replication_sql --replication_seconds_behind_master=0 --replication || [ " $c " -eq 0 ]
721716 do
722717 sleep 1
723718 c=$(( c - 1 ))
728723 cid=$cid_primary killoff
729724 die " Table contents didn't match on replica"
730725 fi
731- docker exec --user mysql -i \
732- " $cname " \
733- $mariadb \
734- -e " SHOW SLAVE STATUS\G"
735726 killoff
736727 cid=$master_host
737728 killoff
0 commit comments