2014/04/23

mysql 複数マスター multi-source replication

5.7からだよ。。
labs.mysql.com

■How does it work?
・Now we have the concept of communication channels. Each communication channel is a connection from slave to master to get the binary log events. That means we will have one IO_THREAD for each communication channel. We will need to run different “CHANGE MASTER” commands, one for each master, with the “FOR CHANNEL” argument that we will use to give a name to that channel
==>
CHANGE MASTER MASTER_HOST='something', MASTER_USER=... FOR CHANNEL="name_of_channel1";
CHANGE MASTER MASTER_HOST='something', MASTER_USER=... FOR CHANNEL="name_of_channel2";   

START slave for channel="name_of_channel1"
START slave for channel="name_of_channel2"

SHOW SLAVE STATUS FOR CHANNEL="name_of_channel1"\G
SHOW SLAVE STATUS FOR CHANNEL="name_of_channel2"\G

SHOW PROCESSLIST;

・he slave should have been configured first with the crash-safe feature of MySQL 5.6. That means that info usually included in master.info or relay-log.info should be on a table.
==>
    master_info_repository=TABLE;
    relay_log_info_repository=TABLE;

■key-words:
MySQL Multi-threaded Slave
MySQL Multi-source Replication