Page MenuHomePhabricator
Authored By
jcrespo
Jul 2 2019, 12:46 PM
Size
1 KB
Referenced Files
None
Subscribers
None
# 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()
[<WMFMariaDB.WMFMariaDB object at 0x7f648108b860>, <WMFMariaDB.WMFMariaDB object at 0x7f648108bcc0>]
>>> 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()
[<WMFMariaDB.WMFMariaDB object at 0x7f648108b828>]
>>> db3r.slaves()
[<WMFMariaDB.WMFMariaDB object at 0x7f648107fda0>]
>>> db2r.move(db1) <------ 5 second wait before change
{'success': True}
>>> db1r.slaves()
[<WMFMariaDB.WMFMariaDB object at 0x7f6480f41a20>, <WMFMariaDB.WMFMariaDB object at 0x7f6480f41e10>]
>>> db3r.slaves()
[]

File Metadata

Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
7692668
Default Alt Text
raw.txt (1 KB)

Event Timeline