Warning about UUID in MySQL master-slave Replication

Source: Internet
Author: User

Date: January 1, May 23, 2014

Blog: Tie

Recently, many warning messages are displayed when you view the error log of the MariaDB Master-Slave replication server Master. They indicate that the UUID () function is insecure, and the Slave value may be different from that of the Master, the warning information is roughly as follows:

140522 15:11:10 [Warning] Unsafe statement written to the binary logusing statement format since BINLOG_FORMAT = STATEMENT.Statement is unsafe because it uses a system function that may return a different value on the slave. Statement: insert into t_user(userId,userName) values(uuid(),'FunYoung')
The general translation is as follows:
140522 15:11:10 [Warning] The statements written to binary logs may be insecure because the format is BINLOG_FORMAT = STATEMENT. the statement is insecure because a system function is used, and execution on the slave server may generate inconsistent values. the statement is as follows: insert into t_user (userId, userName) values (uuid (), 'funyoung ')
It seems that the log format BINLOG_FORMAT = STATEMENT is insecure because the value produced by the slave UUID () function may be different from that of the Master.

I found some information on the Internet and found that version 5.0 is definitely a problem. What should I do? Either modify the implementation, for example, generate a UUID at the application layer, or use a line-based, instead of a statement-based binary log format.

It is said that 5.0 and later are not necessarily true. I read some official documents and it seems that version 5.6 has fixed this issue. Reference link: 22 Changes in MySQL 5.6.0

There is also a 09-year document, said there was this problem: https://drupal.org/node/502622

There is also a more detailed article: Beware of MySQL 5.6 server UUID when cloning slaves

We use MariaDB5.5, which should be compatible with MySQL5.5. After troubleshooting this problem, the system has solved it by itself.

MariaDB [(none)]> select version();+--------------------+| version()          |+--------------------+| 5.5.34-MariaDB-log |+--------------------+1 row in set (0.00 sec)
If you encounter this problem, if you can upgrade the database system, upgrade to the latest version.

If you cannot upgrade DMBS, you need to use the row-based replication method at the application layer.

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.