MariaDB Slave Crash-safe need to switch to Gtid copy mode

Source: Internet
Author: User

Previously wrote an article "MySQL5.6 crash-safe Replication", but mariadb10.0.x and 10.1.X do not support the Relay_log_info_repository = table parameter, The official website recommends using Gtid Copy mode instead of traditional copy mode, traditional replication mode is not supported slave crash-safe.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/72/92/wKiom1Xmr7WRLV1DAAUUod9tlpw045.jpg "title=" g3.png "alt=" Wkiom1xmr7wrlv1daauuod9tlpw045.jpg "/>


Under the MySQL library, there will be a gtid_slave_pos table (which is already the InnoDB engine when the installation is initialized)

START transaction;--Statement 1--...--Statement n--Update replication infocommit;

When the SQL thread finishes executing the transaction, the Gtid_slave_pos table is updated immediately, and if the transaction is rolled back during the update process, the Gtid_slave_pos table does not record the synchronized points and is executed again from the previous POS point when the next resynchronization is replicated.


MariaDB 10 default is traditional replication, if the transition to Gtid is very simple, do not need to be like MySQL5.6, to set log_slave_updates = 1 from the library (increase the IO pressure from the library), and restart the database to become effective so troublesome. MARIADB support Eager swap gtid, you can first build master and slave with traditional copy, and then eagerly gtid copy mode, such as:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/8E/wKioL1XmrouQsk9yAAKZFfQNFDo290.jpg "title=" Gtid.png "alt=" Wkiol1xmrouqsk9yaakzffqnfdo290.jpg "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/72/8E/wKioL1XmrtGxO7l5AALI8ghWW8M548.jpg "title=" Gtid2.png "alt=" Wkiol1xmrtgxo7l5aali8ghww8m548.jpg "/>

With a few simple steps, slave supports crash-safe from the library.


Note: MHA0.56 (the latest version), also does not support the MARIADB10 Gtid replication mode, in the failover, but also with the traditional copy of the master-slave, so it is necessary to manually eagerly change the Gtid mode each time.


Reference website:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/72/92/wKiom1XmrfuwVqIiAAl72MkEipQ780.jpg "title=" Qq20150902160517.png "alt=" Wkiom1xmrfuwvqiiaal72mkeipq780.jpg "/>



This article is from the "Spring Yang Technical column" blog, please be sure to keep this source http://hcymysql.blog.51cto.com/5223301/1690848

MariaDB Slave Crash-safe need to switch to Gtid copy mode

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.