- 原主机(3306)停止服务
- MyCat 自动检测进行主从切换(hostM1转为hostM2)
- 通过mycat insert data,数据只在 3308 的数据库中体现
- 启动原主机mysql 3306 服务
- 手动同步数据 mysql workbench (暂时不知道别的方法,)
- 调整mysql master 和 slave的关系 ,将3308设为主机,3306设为从机,3307配置不动
- 通过mycat 验证新的主从配置
- mycat 不用重启,服务会自动切换
3)具体操作步骤
3.1)停止3308 环境 slave模式 并 开启 master
停止slave
mysql> stop slave;
配置3308为主机模式
mysql> GRANT REPLICATION SLAVE ON *.* to ‘mycat_sync_3308‘@‘%‘ identified by ‘mycat_sync_3308‘;
Query OK, 0 rows affected (0.00 sec)
mysql> show master status;
+------------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000005 | 284 | | |
+------------------+----------+--------------+------------------+
1 row in set (0.00 sec)
3.2)3306 环境开启slave
3.3)原master机切换为slave模式
3.4)数据验证
3.5)mycat 验证
《Mycat学习笔记》 第三篇. MySql 主从同步异常后,主从切换
标签: