# python3 Python 3.7.3 (default, Apr 3 2019, 05:39:12) [GCC 8.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import WMFMariaDB >>> import WMFReplication >>> db1 = WMFMariaDB.WMFMariaDB(host='127.0.0.1') >>> db2 = WMFMariaDB.WMFMariaDB(host='127.0.0.1', port=3307) >>> db3 = WMFMariaDB.WMFMariaDB(host='127.0.0.1', port=3308) >>> db1r = WMFReplication.WMFReplication(db1) >>> db2r = WMFReplication.WMFReplication(db2) >>> db3r = WMFReplication.WMFReplication(db3) >>> db2r.move(db3) {'success': False, 'errno': -1, 'errmsg': 'The host is already configured as a master of 127.0.0.1:3308'} >>> db2r.move(db1) {'success': True} >>> db1r.slaves() [, ] >>> db2r.move(db3) <---- 5 second wait before stop /usr/lib/python3/dist-packages/pymysql/cursors.py:170: Warning: (1278, "It is recommended to use --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL; otherwise, you will get problems if you get an unexpected slave's mysqld restart") result = self._query(query) <---- another 5 second wait to catch up {'success': True} >>> db1r.slaves() [] >>> db3r.slaves() [] >>> db2r.move(db1) <------ 5 second wait before change {'success': True} >>> db1r.slaves() [, ] >>> db3r.slaves() []