Reproduced [Mysql]slave has equal MySQL Server UUIDs Cause and resolution

Source: Internet
Author: User
Tags uuid

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 messages
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 | 33 |
+---------------+-------+

Slave_mysql> Show variables like ' server_id ';
+---------------+-------+
| variable_name | Value |
+---------------+-------+
| server_id | 11 |
+---------------+-------+
--from the above scenario, the master-slave MySQL has used a different server_id

3, 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 # # #重启mysql
Shutting down MySQL. [OK]
Starting MySQL. [OK]
[Email protected] ~]# MORE/DATA/MYSQLDATA/AUTO.CNF # # #重启后自动生成新的auto. cnf file, which is the new UUID
[Auto]
Server-uuid=6ac0fdae-b5d7-11e4-a9f3-0800278ce5c9


# # #再次查看slave的状态已经正常
[Email protected] ~]# mysql-uroot-pxxx-e "show slave status\g" |grep Running
Warning:using a password on the command line interface can is 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

# # #主库端查看自身的uuid
Master_mysql> Show variables like ' Server_uuid ';
+---------------+--------------------------------------+
| variable_name | Value |
+---------------+--------------------------------------+
| Server_uuid | 62ee10aa-b1f7-11e4-90ae-080027615026 |
+---------------+--------------------------------------+
1 row in Set (0.00 sec)

# # #主库端查看从库的uuid
master_mysql> show slave hosts;
+-----------+------+------+-----------+--------------------------------------+
| server_id | Host | Port | master_id | slave_uuid                          |
+-----------+------+------+-----------+--------------------------------------+
|        |      | 3306 |        11 | 62ee10aa-b1f7-11e4-90ae-080027615030 |
|        |      | 3306 |        One | 6ac0fdae-b5d7-11e4-a9f3 -0800278CE5C9 |
+-----------+------+------+-----------+--------------------------------------+
# # # Author:leshami
# # # blog :  http://www.linuxidc.com

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

Transferred from: http://www.linuxidc.com/Linux/2015-02/113564.htm

Reproduced [Mysql]slave has equal MySQL Server UUIDs Cause and resolution

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.