Slave have equal MySQL Server UUIDs
Recently, When I deployed The MySQL master-slave replication architecture, I encountered "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. "error message. That is, the same UUID is used in the master-slave architecture. Check the server_id system variables. They are already different settings. Why? The following is a detailed description.
1. error message
Mysql> show slave staus;
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.
2. view the server_id variable of the Master/Slave node.
Master_mysql> show variables like 'server _ id ';
+ --------------- + ------- +
| Variable_name | Value |
+ --------------- + ------- +
| Server_id | 33 |
+ --------------- + ------- +
Slave_mysql> show variables like 'server _ id ';
+ --------------- + ------- +
| Variable_name | Value |
+ --------------- + ------- +
| Server_id | 11 |
+ --------------- + ------- +
-- From the above situation, we can see that the master and slave mysql have used different server_id
3. troubleshooting
### View the auto. cnf File
[Root @ dbsrv1 ~] Cat/data/mysqldata/auto. cnf ### uuid on the master
[Auto]
Server-uuid = 62ee10aa-b1f7-11e4-90ae-080027615026
[Root @ dbsrv2 ~] # More/data/mysqldata/auto. cnf ### the previous uuid already exists. The reason is that the virtual machine is cloned, but the server_id cannot be changed.
[Auto]
Server-uuid = 62ee10aa-b1f7-11e4-90ae-080027615026
[Root @ dbsrv2 ~] # Mv/data/mysqldata/auto. cnf/data/mysqldata/auto. cnf. bk ### rename the file
[Root @ dbsrv2 ~] # Service mysql restart ### restart mysql
Shutting down MySQL. [OK]
Starting MySQL. [OK]
[Root @ dbsrv2 ~] # More/data/mysqldata/auto. cnf ### automatically generate a new auto. cnf file after restart, that is, the new UUID
[Auto]
Server-uuid = 6ac0fdae-b5d7-11e4-a9f3-0800278ce5c9
### Check whether the slave status is normal again
[Root @ dbsrv1 ~] # Mysql-uroot-pxxx-e "show slave status \ G" | grep Running
Warning: Using a password on the command line interface can be insecure.
Slave_IO_Running: Yes
Slave_ SQL _Running: Yes
Slave_ SQL _Running_State: Slave has read all relay log; waiting for the slave I/O thread to update it
### View the uuid of the master database
Master_mysql> show variables like 'server _ uuid ';
+ --------------- + -------------------------------------- +
| Variable_name | Value |
+ --------------- + -------------------------------------- +
| Server_uuid | 62ee10aa-b1f7-11e4-90ae-080027615026 |
+ --------------- + -------------------------------------- +
1 row in set (0.00 sec)
### View the uuid of the slave database on the master database
Master_mysql> show slave hosts;
+ ----------- + ------ + ----------- + -------------------------------------- +
| Server_id | Host | Port | Master_id | Slave_UUID |
+ ----------- + ------ + ----------- + -------------------------------------- +
| 33 | 3306 | 11 | 62ee10aa-b1f7-11e4-90ae-080027615030 |
| 22 | 3306 | 11 | 6ac0fdae-b5d7-11e4-a9f3-0800278ce5c9 |
+ ----------- + ------ + ----------- + -------------------------------------- +
### Author: Leshami
### Blog: