1.授权(192.168.2.173)
grant replication slave on *.* to ‘fs_repl‘@‘192.168.2.%‘ identified by ‘fsIJNertP‘;
flush privileges;
2.导出数据(192.168.2.173)
/usr/local/mysql/bin/mysqldump -uroot -p FsUI&enc --master-data --databases fullshare_eberp fullshare_pay qrtz_jobs >>/data1/backup/20180315.sql
STOP SLAVE FOR CHANNEL ‘Master_3‘;
RESET SLAVE FOR CHANNEL ‘Master_3‘;
3.导入数据(192.168.2.171)
4.设置主从
-- 这个设置中的 MASTER_LOG_FILE,MASTER_LOG_POS需要改成导出的SQL中的相对应的数
CHANGE MASTER TO MASTER_HOST=‘192.168.2.173‘,
MASTER_USER=‘fs_repl‘,
MASTER_PORT=3306,
MASTER_PASSWORD=‘fsIJNertP‘,
MASTER_LOG_FILE=‘binlog.000010‘,
MASTER_LOG_POS=6992508 FOR CHANNEL ‘Master_3‘;
5.启动
mysql>START SLAVE FOR CHANNEL ‘Master_3‘;
6.查看主从状态
mysql> SHOW SLAVE STATUS FOR CHANNEL ‘Master_3‘\G;