Recently, when deploying 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 s Erver UUIDs; These uuids must is different for replication to work. "This error prompt. That is, the same UUID is used in the master-slave architecture. Check the SERVER_ID system variable, which is already a different setting, what is the reason? 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 is different for replication to work. 2, see the master-slave server_id variable master_mysql> show variables like ' server_id '; +---------------+-------+| variable_name | Value |+---------------+-------+| server_id | |+---------------+-------+slave_mysql> show variables like ' server_id '; +---------------+-------+| variable_name | Value |+---------------+-------+| server_id | One |+---------------+-------+--from the above situation, master and slave MySQL has used different server_id3, solve the problem # # #查看auto. cnf file [[email protected] ~] CAT/DATA/MYSQLDATA/AUTO.CNF # # # Lord's uuid[auto]server-uuid=62ee10aa-b1f7-11e4-90ae-080027615026[[email Protected] ~]# more/data/mysqldata/auto.cnf # # #从上的uuid, sure enough, the reason is to clone the virtual machine, only change server_id not [auto]server-uuid= 62ee10aa-b1f7-11e4-90ae-080027615026[[email protected] ~]# mv/data/mysqldata/auto.cnf/data/mysqldata/ AUTO.CNF.BK # # #重命名该文件 [[Email protected] ~]# service mysql Restart # # #重启mysqlShutting down MySQL. [OK] Starting MySQL. [OK] [[email protected] ~]# more/data/mysqldata/auto.cnf # # #重启后自动生成新的auto. cnf file, that is, the new uuid[auto]server-uuid= 6ac0fdae-b5d7-11e4-a9f3-0800278ce5c9## #再次查看slave的状态已经正常 [[email protected] ~]# mysql-uroot-pxxx-e "show slave Status\g "|grep runningwarning:using a password on the command line interface can be insecure. Slave_io_running:yes Slave_sql_running:yes Slave_sql_running_state:slave have read all relay log; Waiting for the slave I/O thread to update it## #主库端查看自身的uuidmaster_mysql > show variables like ' server_uuid '; +---------- -----+--------------------------------------+| variable_name | Value |+---------------+--------------------------------------+| Server_uuid | 62ee10aa-b1f7-11e4-90ae-080027615026 |+---------------+--------------------------------------+1 row in Set (0.00 sec ) # # #主库端查看从库的uuidmaster_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:http://blog.csdn.net/leshami
4. Extension reference
A, the description of the server_id
The server ID, used in replication to give each master and slave a unique identity. This variable is set
By the--server-id option. For each server participating in replication, you should pick a
The positive integer in the range is from 1 to 232–1 (2 of 32 reduction 1) to act as that server ' s ID.
b, the description of the Server_uuid
Beginning with MySQL 5.6, the server generates a true UUID on addition to the--server-id
Supplied by the user. This is available as the global, read-only variable server_uuid (Global read-only variable)
When starting, the MySQL server automatically obtains a UUID as follows:
a). Attempt to read and use the UUID written in the file data_dir/auto.cnf (where Data_dir is
The server ' s data directory); Exit on success.
b). Otherwise, generate a new UUID and save it to this file, creating the file if necessary.
The auto.cnf file has a format similar to, used for my.cnf or my.ini files. In MySQL 5.6,
AUTO.CNF have only a single [auto] sections containing a single Server_uuid [1992] Setting and
Value
Important
The auto.cnf file is automatically generated; You should not attempt to write
or modify this file
Also beginning with MySQL 5.6, when using MySQL replication, masters and slaves know one
Another ' s UUIDs. The value of a slave ' s UUID can be seen in the output of SHOW slave HOSTS. Once
START SLAVE has been executed (and not before), the value of the master's UUID is available on the
Slave in the output of SHOW slave STATUS.
In MySQL 5.6.5 and later, a server's server_uuid is also used in Gtids for transactions originating
On the server. For more information, see section 16.1.3, "Replication with Global Transaction
Slave has equal MySQL server UUIDs