最近学到一个新技巧,多实例数据库表同步到一个实例上
具体要求是说,把实例1上A库的表a、表d和实例2上的B库的表b同步到实例3上的C库
环境:
实例3306
库A 表a 库D 表d 同步账户test@localhost 同步管道 channel 100
实例3307
库B 表b 同步账户east@localhost 同步管道 channel 200
实例3308
库C 从实例3306、3307下同步a、b、d
多实例具体步骤和单实例一样,同样配置
在change master时,需要指定不同的端口,以及给管道channel命不同的名
change master to master_host='localhost',master_user='east',master_password='123456',master_port=3307,master_log_file='mysql-bin.000021',master_log_pos=1680 for channel '200'; change master to master_host='localhost',master_user='test',master_password='123456',master_port=3306,master_log_file='mysql-bin.00005',master_log_pos=449 for channel '100';
这样就会存在3个slave状态,原主从同步无指定端口和管道状态
测试结果
tips:
报错1:
Got fatal error 1236 from master when reading data from binary log:
‘Could not find first log file name in binary log index file’
再次查看主服务器状态
show master satuts
然后change ,change需指定端口和管道,才能更新到对应的实例位置



