| 1 |
# Set up Semi-Sync with rpl_semi_sync_master_wait_no_slave=0 |
| 2 |
include/master-slave.inc |
| 3 |
[connection master] |
| 4 |
SET @@GLOBAL.rpl_semi_sync_master_enabled= 1; |
| 5 |
SET @@GLOBAL.rpl_semi_sync_master_wait_no_slave= 0; |
| 6 |
connection slave; |
| 7 |
SET @@GLOBAL.rpl_semi_sync_slave_enabled= 1; |
| 8 |
include/start_slave.inc |
| 9 |
connection master; |
| 10 |
connection slave; |
| 11 |
connection master; |
| 12 |
SELECT ID INTO @binlog_dump_tid |
| 13 |
FROM information_schema.PROCESSLIST WHERE COMMAND = 'Binlog Dump'; |
| 14 |
# Wait for the Control State |
| 15 |
SHOW STATUS LIKE 'Rpl\_semi\_sync\_master\_clients'; |
| 16 |
Variable_name Value |
| 17 |
Rpl_semi_sync_master_clients 1 |
| 18 |
# Disable Semi-Sync while the dump thread is still connected to its slave |
| 19 |
SET @@GLOBAL.rpl_semi_sync_master_enabled = 0; |
| 20 |
SELECT STATE FROM information_schema.PROCESSLIST WHERE ID = @binlog_dump_tid; |
| 21 |
STATE |
| 22 |
Master has sent all binlog to slave; waiting for more updates |
| 23 |
SHOW STATUS LIKE 'Rpl\_semi\_sync\_master\_clients'; |
| 24 |
Variable_name Value |
| 25 |
Rpl_semi_sync_master_clients 1 |
| 26 |
# Disconnect the slave and wait until the master's dump thread is gone |
| 27 |
connection slave; |
| 28 |
STOP SLAVE; |
| 29 |
connection master; |
| 30 |
SHOW STATUS LIKE 'Rpl\_semi\_sync\_master\_clients'; |
| 31 |
Variable_name Value |
| 32 |
Rpl_semi_sync_master_clients 0 |
| 33 |
# Cleanup |
| 34 |
SET @@GLOBAL.rpl_semi_sync_master_enabled= 0; |
| 35 |
SET @@GLOBAL.rpl_semi_sync_master_wait_no_slave= 1; |
| 36 |
connection slave; |
| 37 |
SET @@GLOBAL.rpl_semi_sync_slave_enabled= 0; |
| 38 |
include/rpl_end.inc |