实验环境

操作系统:CentOS Linux release 7.3.1611 (Core)

数据库系统: MySQL 5.7.19

部署mysql的ab复制的时候出现的UUID的问题,

mysql> show slave status\G;

Last_IO_Error: Fatal error: The slave I/O thread stops because master and slave have equal MySQL server UUIDs; these UUIDs must be different for replication to work.

问题提示主从使用了相同的server UUID,一个个的检查:

检查主从server_id

mysql> show master status;
+------------------+----------+--------------+------------------+-------------------+
| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+-------------------+
| mysql-bin.000001 |      154 |              |                  |                   |
+------------------+----------+--------------+------------------+-------------------+
1 row in set (0.00 sec)
————————————————
检查从库的uuid

mysql> show master status;
+------------------+----------+--------------+------------------+-------------------+
| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+-------------------+
| mysql-bin.000001 |      408 |              |                  |                   |
+------------------+----------+--------------+------------------+-------------------+
1 row in set (0.00 sec)

发现文件是一样的需要再查看别的
 

vim /var/lib/mysql/auto.cnf

[auto] server-uuid=4f37a731-9b79-11e8-8013-000c29f0700f

发现主从的这个auto.cnf中的uuid是一样的

解决办法

停止从库的mysql

systemctl stop mysqld

然后

所以删除或者是移走从库的auto.cnf

直接重启MySQL 集群

systemctl restart mysqld

进入到mysql的交互

直接查看是两个yes 直接成功

The slave I/O thread stops because master and slave have equal MySQL server UUIDs

若是出现报错

Got fatal error 1236 from master when reading data from binary log: 'Could not find first log file name in binary log index file'

 

可以

stop slave;

reset slave;

start slave;

一般的通过这几步骤就可以搞定了

相关文章: