Gtid copy of MySQL

Source: Internet
Author: User

MySQL has a new feature in 5.6 when it comes to using gtid from replication, compared to traditional master-slave replication using the log_pos+log_file specified in Relaylog. When using Gtid master from replication, you can not specify slave requirements to read which Binlog and offsets in primary. In a traditional MySQL master-slave copy, once the offset of the wrong master is specified, it will cause the master to never be consistent, and this will not occur in a master-slave replication based on Gtid. Gtid is actually the ID generated after the master commits a transaction, so the configuration parameters of Enforce_gtid_consistency (forced transaction-consistent) are usually turned on during configuration to ensure Gtid security. However, it is important to note that if you turn on enforce_gtid_consistency on, you cannot create and delete temporary tables in a transaction, such as creating a temporary table:

Create temporary table suggested change to create table

In addition to also open log_slave_updates, this variable in master and slave will be open, in addition to the doubt is necessary to open binlog, as for the other general and Log_pos+log_file master-slave replication similar, Here is to say that a different place, as for the other has previously said Log_pos+log_file of the master and slave replication needs to see: http://jim123.blog.51cto.com/4763600/ 1862808, in master and slave to open the relevant variables Gtid, of course, if it is allowed to restart the first configuration of the two my.cnf is better, where both of the MY.CNF [mysqld] need to add is:

Log_slave_updates = Ongtid_mode = Onenforce_gtid_consistency = On is recommended to turn on read-only at slave: Read_Only = On

In the configuration process, it is best to close the master write and turn on read-only:

mysql> Set Global read_only = on; Query OK, 0 rows Affected (0.00 sec)

When the corresponding variable parameter is turned on, the master-slave copy of the point and log_pos+log_file on the slave is compared with master_auto_position.

Change Master to master_host= ' 192.168.168.253 ', master_user= ' test_backup ', master_password= ' test_backup ', master_ Auto_position = 1;

After opening, you can view the Gtid parameter variables:

Mysql> show global variables like '%gtid% ';


This article from "Jim's Technical Essay" blog, reproduced please contact the author!

Gtid copy of MySQL

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.