$ docker-compose exec master mysql -uroot -ppass
MariaDB [(none)]> GRANT REPLICATION SLAVE ON *.* TO 'replication'@'%';
Query OK, 0 rows affected (0.01 sec)
MariaDB [(none)]> SHOW MASTER STATUS;
+--------------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+--------------------+----------+--------------+------------------+
| mariadb-bin.000005 | 493 | | |
+--------------------+----------+--------------+------------------+
1 row in set (0.00 sec)
MariaDB [(none)]> SELECT BINLOG_GTID_POS('mariadb-bin.000005', 493);
+--------------------------------------------+
| BINLOG_GTID_POS('mariadb-bin.000005', 493) |
+--------------------------------------------+
| 0-1-7160 |
+--------------------------------------------+
1 row in set (0.00 sec)
$ docker-compose exec slave mysql -uroot -ppass
MariaDB [(none)]> SET GLOBAL gtid_slave_pos = '0-1-7160';
MariaDB [(none)]> CHANGE MASTER 'europe' TO MASTER_HOST='master', MASTER_USER='replication', MASTER_PASSWORD='replicationpass', MASTER_USE_GTID=slave_pos;
Query OK, 0 rows affected (0.058 sec)
MariaDB [(none)]> START SLAVE 'europe';
Query OK, 0 rows affected (0.035 sec)
MariaDB [(none)]> GRANT REPLICATION SLAVE ON *.* TO 'replication'@'%'; # when we do the switchover and the slave becomes the master, the user needs also grants here
$ docker-compose exec manager sh
/ # replication-manager-cli switchover
| Group: Default | Mode: Manual
Id Host Port Status Failures Using GTID Current GTID Slave GTID Replication Health Delay RO
db2333073917932517382 master 3306 Master 0 No 0-1-7161 0 OFF
db17127326350201208329 slave 3306 Slave 0 Slave_Pos 0-1-7161 0-1-7161 0 ON
INFO[2019-06-08T11:21:50Z] 2019-06-08 11:21:50 [Default] INFO - Master switch on slave:3306 complete
INFO[2019-06-08T11:21:50Z] 2019-06-08 11:21:50 [Default] INFO - Switching other slaves to the new master
INFO[2019-06-08T11:21:50Z] 2019-06-08 11:21:49 [Default] INFO - Doing MariaDB GTID switch of the old master
INFO[2019-06-08T11:21:50Z] 2019-06-08 11:21:49 [Default] INFO - Switching old master as a slave
INFO[2019-06-08T11:21:50Z] 2019-06-08 11:21:49 [Default] INFO - Inject fake transaction on new master slave:3306
INFO[2019-06-08T11:21:50Z] 2019-06-08 11:21:49 [Default] INFO - Resetting slave on new master and set read/write mode on
INFO[2019-06-08T11:21:50Z] 2019-06-08 11:21:49 [Default] INFO - Stopping slave threads on new master
INFO[2019-06-08T11:21:50Z] 2019-06-08 11:21:49 [Default] DEBUG - Candidate was in sync=false
INFO[2019-06-08T11:21:50Z] 2019-06-08 11:21:49 [Default] DEBUG - master_log_pos=614
INFO[2019-06-08T11:21:50Z] 2019-06-08 11:21:49 [Default] DEBUG - master_log_file=mariadb-bin.000005
INFO[2019-06-08T11:21:50Z] 2019-06-08 11:21:49 [Default] DEBUG - Save replication status before electing
INFO[2019-06-08T11:21:50Z] 2019-06-08 11:21:49 [Default] INFO - Reading all relay logs on slave:3306
INFO[2019-06-08T11:21:50Z] 2019-06-08 11:21:49 [Default] INFO - Waiting for candidate master to apply relay log
INFO[2019-06-08T11:21:50Z] 2019-06-08 11:21:49 [Default] INFO - Rejecting updates on master:3306 (old master)
INFO[2019-06-08T11:21:50Z] 2019-06-08 11:21:49 [Default] INFO - Terminating all threads on master:3306
INFO[2019-06-08T11:21:50Z] 2019-06-08 11:21:49 [Default] INFO - Slave slave:3306 has been elected as a new master
INFO[2019-06-08T11:21:50Z] 2019-06-08 11:21:49 [Default] INFO - Electing a new master
INFO[2019-06-08T11:21:50Z] 2019-06-08 11:21:49 [Default] INFO - Flushing tables on master master:3306
INFO[2019-06-08T11:21:50Z] 2019-06-08 11:21:49 [Default] INFO - Checking long running updates on master 10
INFO[2019-06-08T11:21:50Z] 2019-06-08 11:21:49 [Default] INFO - --------------------------
INFO[2019-06-08T11:21:50Z] 2019-06-08 11:21:49 [Default] INFO - Starting master switchover
INFO[2019-06-08T11:21:50Z] 2019-06-08 11:21:49 [Default] INFO - --------------------------
INFO[2019-06-08T11:21:50Z] 2019-06-08 11:21:49 [Default] DEBUG - Lookup server slave:3306 if maxscale binlog server: master:3306
INFO[2019-06-08T11:21:50Z] 2019-06-08 11:21:49 [Default] DEBUG - Lookup server master:3306 if maxscale binlog server: master:3306
INFO[2019-06-08T11:21:50Z] 2019-06-08 11:21:49 [Default] DEBUG - Lookup server slave:3306 if maxscale binlog server: master:3306
INFO[2019-06-08T11:21:50Z] 2019-06-08 11:21:49 [Default] DEBUG - Lookup server master:3306 if maxscale binlog server: master:3306
| Group: Default | Mode: Manual
Id Host Port Status Failures Using GTID Current GTID Slave GTID Replication Health Delay RO
db2333073917932517382 master 3306 Slave 0 No 0-1-7161 0 ON
db17127326350201208329 slave 3306 Master 0 No 0-2-7236 0-1-7161 0 OFF