Last_IO_Error: Fatal error:slave have equal MySQL Server UUIDs原因及解决
发表于:2024-12-12 作者:千家信息网编辑
千家信息网最后更新 2024年12月12日,最近在虚拟机上部署MySQL主从复制架构的时候,碰到了"Last_IO_Error: Fatal error: The slave I/O thread stops because master an
千家信息网最后更新 2024年12月12日Last_IO_Error: Fatal error:slave have equal MySQL Server UUIDs原因及解决最近在虚拟机上部署MySQL主从复制架构的时候,碰到了
"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."
这个错误提示。
即主从架构中使用了相同的UUID。检查server_id系统变量,已经是不同的设置,那原因是?
1、错误提示:
mysql> show slave status \G;
*************************** 1. row ***************************
Slave_IO_State:
Master_Host: 192.168.30.138
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: binlog.000023
Read_Master_Log_Pos: 331
Relay_Log_File: mysql2-relay-bin.000001
Relay_Log_Pos: 4
Relay_Master_Log_File: binlog.000023
Slave_IO_Running: No
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 331
Relay_Log_Space: 120
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
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.
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 1
Master_UUID:
Master_Info_File: /data/mysql/data/master.info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for the slave I/O thread to update it
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp: 160520 10:54:33
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set:
Auto_Position: 0
1 row in set (0.00 sec)
查看slave的状态时Last_IO_Error有错误提示。
2、检查server_id和UUID
master:
mysql> show variables like '%server%';
+---------------------------------+--------------------------------------+
| Variable_name | Value |
+---------------------------------+--------------------------------------+
| character_set_server | utf8 |
| collation_server | utf8_general_ci |
| innodb_ft_server_stopword_table | |
| server_id | 1 |
| server_id_bits | 32 |
| server_uuid | e5fa0e64-0c48-11e6-a2f7-000c292545f2 |
+---------------------------------+--------------------------------------+
6 rows in set (0.00 sec)
slave:
mysql> show variables like '%server%';
+---------------------------------+--------------------------------------+
| Variable_name | Value |
+---------------------------------+--------------------------------------+
| character_set_server | utf8 |
| collation_server | utf8_general_ci |
| innodb_ft_server_stopword_table | |
| server_id | 2 |
| server_id_bits | 32 |
| server_uuid | e5fa0e64-0c48-11e6-a2f7-000c292545f2 |
+---------------------------------+--------------------------------------+
6 rows in set (0.00 sec)
从上面的可过看到两边server_id不一致,但是UUID是一致的。
检查auto.cnf文件
此文件在datadir目录
[root@mysql1 data]# cat auto.cnf
[auto]
server-uuid=e5fa0e64-0c48-11e6-a2f7-000c292545f2
[root@mysql2 data]# cat auto.cnf
[auto]
server-uuid=e5fa0e64-0c48-11e6-a2f7-000c292545f2
3、解决方法
因为我这是虚拟机操作,整个系统使用了克隆的方式搭建的从库,所以导致了主从UUID一致。
1)删除从库上原来的auto.cnf文件
[root@mysql2 data]# mv auto.cnf auto.cnf.bak
2)重启MySQL进程
[root@mysql2 data]# service mysqld restart
Shutting down MySQL.. [ OK ]
Starting MySQL.... [ OK ]
[root@mysql2 data]#
3)查看auto.cnf文件,UUID已经发生了变化
[root@mysql2 data]# cat auto.cnf
[auto]
server-uuid=0f7d1af5-1e37-11e6-97e2-000c29a23ba9
4)重启slave
[root@mysql2 data]# mysql -uroot -p
Enter password:
。。。。。。。。。。。
mysql> start slave;
Query OK, 0 rows affected, 1 warning (0.00 sec)
5)查看slave状态。
mysql> show slave status \G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.30.138
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: binlog.000023
Read_Master_Log_Pos: 410
Relay_Log_File: mysql2-relay-bin.000003
Relay_Log_Pos: 359
Relay_Master_Log_File: binlog.000023
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 410
Relay_Log_Space: 533
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 1
Master_UUID: e5fa0e64-0c48-11e6-a2f7-000c292545f2
Master_Info_File: /data/mysql/data/master.info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for the slave I/O thread to update it
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set:
Auto_Position: 0
1 row in set (0.00 sec)
至此问题解决,同步正常。
在虚拟机克隆方式搭建主从时需要注意,否则容易出现上面的问题。
"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."
这个错误提示。
即主从架构中使用了相同的UUID。检查server_id系统变量,已经是不同的设置,那原因是?
1、错误提示:
mysql> show slave status \G;
*************************** 1. row ***************************
Slave_IO_State:
Master_Host: 192.168.30.138
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: binlog.000023
Read_Master_Log_Pos: 331
Relay_Log_File: mysql2-relay-bin.000001
Relay_Log_Pos: 4
Relay_Master_Log_File: binlog.000023
Slave_IO_Running: No
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 331
Relay_Log_Space: 120
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
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.
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 1
Master_UUID:
Master_Info_File: /data/mysql/data/master.info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for the slave I/O thread to update it
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp: 160520 10:54:33
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set:
Auto_Position: 0
1 row in set (0.00 sec)
查看slave的状态时Last_IO_Error有错误提示。
2、检查server_id和UUID
master:
mysql> show variables like '%server%';
+---------------------------------+--------------------------------------+
| Variable_name | Value |
+---------------------------------+--------------------------------------+
| character_set_server | utf8 |
| collation_server | utf8_general_ci |
| innodb_ft_server_stopword_table | |
| server_id | 1 |
| server_id_bits | 32 |
| server_uuid | e5fa0e64-0c48-11e6-a2f7-000c292545f2 |
+---------------------------------+--------------------------------------+
6 rows in set (0.00 sec)
slave:
mysql> show variables like '%server%';
+---------------------------------+--------------------------------------+
| Variable_name | Value |
+---------------------------------+--------------------------------------+
| character_set_server | utf8 |
| collation_server | utf8_general_ci |
| innodb_ft_server_stopword_table | |
| server_id | 2 |
| server_id_bits | 32 |
| server_uuid | e5fa0e64-0c48-11e6-a2f7-000c292545f2 |
+---------------------------------+--------------------------------------+
6 rows in set (0.00 sec)
从上面的可过看到两边server_id不一致,但是UUID是一致的。
检查auto.cnf文件
此文件在datadir目录
[root@mysql1 data]# cat auto.cnf
[auto]
server-uuid=e5fa0e64-0c48-11e6-a2f7-000c292545f2
[root@mysql2 data]# cat auto.cnf
[auto]
server-uuid=e5fa0e64-0c48-11e6-a2f7-000c292545f2
3、解决方法
因为我这是虚拟机操作,整个系统使用了克隆的方式搭建的从库,所以导致了主从UUID一致。
1)删除从库上原来的auto.cnf文件
[root@mysql2 data]# mv auto.cnf auto.cnf.bak
2)重启MySQL进程
[root@mysql2 data]# service mysqld restart
Shutting down MySQL.. [ OK ]
Starting MySQL.... [ OK ]
[root@mysql2 data]#
3)查看auto.cnf文件,UUID已经发生了变化
[root@mysql2 data]# cat auto.cnf
[auto]
server-uuid=0f7d1af5-1e37-11e6-97e2-000c29a23ba9
4)重启slave
[root@mysql2 data]# mysql -uroot -p
Enter password:
。。。。。。。。。。。
mysql> start slave;
Query OK, 0 rows affected, 1 warning (0.00 sec)
5)查看slave状态。
mysql> show slave status \G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.30.138
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: binlog.000023
Read_Master_Log_Pos: 410
Relay_Log_File: mysql2-relay-bin.000003
Relay_Log_Pos: 359
Relay_Master_Log_File: binlog.000023
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 410
Relay_Log_Space: 533
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 1
Master_UUID: e5fa0e64-0c48-11e6-a2f7-000c292545f2
Master_Info_File: /data/mysql/data/master.info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for the slave I/O thread to update it
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set:
Auto_Position: 0
1 row in set (0.00 sec)
至此问题解决,同步正常。
在虚拟机克隆方式搭建主从时需要注意,否则容易出现上面的问题。
主从
文件
一致
错误
提示
检查
方式
架构
状态
系统
问题
面的
原因
不同
相同
变量
方法
时候
目录
至此
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
sql数据库显示suspect
mc斗罗大陆服务器竞技场玩法
福建企业软件开发市价
购物车代码实现数据库jsp
信息网络安全教案
信阳计算机网络技术教程
服务器的服务有那些
中兴机顶盒联通服务器繁忙
阿里云免费申请服务器步骤
帮我搜索一下网络安全小报
美国网络安全主管
国家网络安全专业怎么样
软件开发平均岁数
福建众聚互联网科技信息
猎杀对决服务器推荐
浙江15项互联网领先科技成果
网络安全管理局局长信箱
怎么进入博士论文全文数据库
一般管理员怎么登录服务器
广东电网 网络安全 制度
浪潮软件怎样看数据库帐
华为服务器2288管理口ip
非网站应用服务器
csgo韩国服务器目前
哪个软件开发培训机构
海淀区正规软件开发诚信经营
数据库功能的三个部分
外审软件开发需准备资料
发展到高级网络安全工程师后
政府网络安全简报