【问题描述】:
在slave库上发现报错:
- mysql> SHOW SLAVE STATUS\G
…………………………………………
Last_IO_Errno: 1593
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.
…………………………………………
错误提示很明显,master的uuid和slave的uuid相等,uuid必须不一样才能使复制开始生效。
在两个库上分别查看:
-
mysql> SHOW VARIABLES LIKE '%server_%';
-
+---------------------------------+--------------------------------------+
-
| Variable_name | Value |
-
+---------------------------------+--------------------------------------+
-
| innodb_ft_server_stopword_table | |
-
| server_id | 11 |
-
| server_id_bits | 32 |
-
| server_uuid | feac17c0-d55e-11e5-b426-525400079dc4 |
-
+---------------------------------+--------------------------------------+
-
4 rows in set (0.00 sec)
-
-
-
mysql> SHOW VARIABLES LIKE '%server_%';
-
+---------------------------------+--------------------------------------+
-
| Variable_name | Value |
-
+---------------------------------+--------------------------------------+
-
| innodb_ft_server_stopword_table | |
-
| server_id | 22 |
-
| server_id_bits | 32 |
-
| server_uuid | feac17c0-d55e-11e5-b426-525400079dc4 |
-
+---------------------------------+--------------------------------------+
- 4 rows in set (0.00 sec)
产生这个的原因:
拿虚拟机做实验,第一台装好了mysql-server,然后直接拿第一台copy成第二台导致。
导致$datadir/auto.cnf里的内容一致:
[auto]
server_uuid= xxxxxxxx
【解决方案】:
我的做法是随机拿一个uuid()函数产生的值复制并修改即可:
- mysql> SELECT uuid();

不过这个参数是静态的,所以需要重启mysql。
作者微信公众号(持续更新)

