Slave have equal MySQL server UUIDs, equaluuids

Source: Internet
Author: User

Slave have equal MySQL server UUIDs, equaluuids

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. Check the master-slave server_id variable master_mysql> show variables like 'server _ id '; + --------------- + ------- + | Variable_name | Value | + --------------- + ------- + | server_id | 33 | + --------------- + ------- + slave_mysql> show vari Ables like 'server _ id'; + --------------- + ------- + | Variable_name | Value | + --------------- + ------- + | server_id | 11 | + ------------- + ------- + -- as shown in the preceding figure, the master and slave mysql have used different server_id3 to solve the fault ### view auto. cnf file [root @ dbsrv1 ~] Cat/data/mysqldata/auto. cnf ### uuid [auto] server-uuid = 62ee10aa-b1f7-11e4-90ae-080027615026 [root @ dbsrv2 ~] # More/data/mysqldata/auto. cnf ### the above uuid already exists because the VM is cloned and changed to server_id. [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 mysqlShutting down MySQL. [OK] Starting MySQL. [OK] [root @ dbsrv2 ~] # More/data/mysqldata/auto. cnf ### automatically generate a new auto after restart. cnf file, 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 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 has read all relay log; waiting for the slave I/O thread to update it ### check your uidmaster_mysql> show variables like 'server _ uuid 'on the master database '; + --------------- + bytes + | Variable_name | Value | + ----------------- + ------------------------------------ + | server_uuid | bytes | + --------------- + bytes + 1 row in set (0.00 sec) ### view the slave database's uuidmaster_mysql> show slave hosts; + ----------- + ------ + ----------- + response + | Server_id | Host | Port | Master_id | Slave_UUID | + ----------- + ------ + ----------- + response + | 33 | 3306 | 11 | bytes | 22 | 3306 | 11 | bytes | + ----------- + ------ + ----------- + -------------------------------------- + ## Author: leshami ### Blog: http://blog.csdn.net/leshami


4. Yansheng reference
A. server_id description
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 participant ipating in replication, you shoshould pick
Positive integer in the range from 1 to 232-1 (the power of 2 minus 1) to act as that server's ID.

 

B. Description of server_uuid
Beginning with MySQL 5.6, the server generates a true UUID in 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 that used for my. cnf or my. ini files. In MySQL 5.6,
Auto. cnf has only a single [auto] section containing a single server_uuid [1992] setting and
Value;

 

Important
The auto. cnf file is automatically generated; you shoshould 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 (but not before), the value of the master's UUID is available on
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 that server. For more information, see Section 16.1.3, "Replication with Global Transaction

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.