@@ -42,18 +42,11 @@ die()
42
42
}
43
43
trap " killoff" EXIT
44
44
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
57
50
RPL_MONITOR=" REPLICATION CLIENT"
58
51
fi
59
52
685
678
-e MARIADB_USER=bob \
686
679
-e MARIADB_PASSWORD=roger \
687
680
-e MARIADB_DATABASE=rabbit \
681
+ -e MARIADB_REPLICATION_USER=" repluser" \
682
+ -e MARIADB_REPLICATION_PASSWORD=" replpassword" \
688
683
" ${image} " --log-bin --log-basename=my-mariadb
689
684
readarray -t vals < <( mariadbclient -u root --batch --skip-column-names -e ' show master status\G' )
690
685
lastfile=" ${vals[1]} "
706
701
-d \
707
702
--rm \
708
703
--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" \
710
707
-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} " \
714
709
--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' \
716
711
--health-interval=3s \
717
712
" $image " --server-id=2 --port 3307)
718
713
719
714
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 ]
721
716
do
722
717
sleep 1
723
718
c=$(( c - 1 ))
728
723
cid=$cid_primary killoff
729
724
die " Table contents didn't match on replica"
730
725
fi
731
- docker exec --user mysql -i \
732
- " $cname " \
733
- $mariadb \
734
- -e " SHOW SLAVE STATUS\G"
735
726
killoff
736
727
cid=$master_host
737
728
killoff
0 commit comments