ITPub博客

首页 > 数据库 > MySQL > master and slave have equal MySQL server ids

master and slave have equal MySQL server ids

原创 MySQL 作者:goolen 时间:2014-08-13 16:53:02 0 删除 编辑
看到一网友在群里发的
mysql从库无法进行同步,查看状态,报如下错误:
Slave_IO_Running: No
Slave_SQL_Running: Yes
Last_IO_Error: Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; these ids must be different for replication to work (or the --replicate-same-server-id option must be used on slave but this does not always make sense; please check the manual before using it).

从错误信息就能看出来,此错误是因为master和slave库上的server_id相同导致,而主从结构,这个值是必须不能相同的

在主库上查询:
mysql> show variables like 'server_id';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| server_id     | 1     |
+---------------+-------+
1 row in set (0.00 sec)

在备库上查询:
mysql> show variables like 'server_id';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| server_id     | 2     |
+---------------+-------+
1 row in set (0.00 sec)

虽然他给出的结果显示主从上的server_id是不同的
我猜想他应该是用set 命令修改的这个参数而没有重启mysql服务

重启一下mysql,然后再查看状态,已经恢复正常。
[root@localhost ~]# /etc/init.d/mysql restart
Shutting down MySQL (Percona Server).......                [  OK  ]
Starting MySQL (Percona Server)..                          [  OK  ]


Last_IO_Errno: 0
Last_IO_Error: 
Last_SQL_Errno: 0
Last_SQL_Error: 
Replicate_Ignore_Server_Ids: 
             Master_Server_Id: 1
1 row in set (0.00 sec)

ERROR: 
No query specified

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/23249684/viewspace-1250682/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2011-10-20

  • 博文量
    121
  • 访问量
    731657