MySQL5.6 semi-synchronous replication to ensure database consistency

Source: Internet
Author: User

semi-synchronous replication requires the use of plug-ins, and master and slave nodes need to install plugins. After the plug-in is installed , configure system variables to enable and disable the semi-synchronous replication feature.

1. semi-synchronous implementation Prerequisites

database version is 5.5 or higher

have_dynamic_loading system variable is YES.

replication is running correctly.

2. Installing plugins

Main node Install PLUGIN rpl_semi_sync_master SONAME ' semisync_master.so '; from node install PLUGIN rpl_semi_sync_slave SONAME ' Semisync_slave.so ';


3. see if the installation was successful

show plugins; display similar instructions for installation success  | rpl_semi_sync_master    | ACTIVE    | REPLICATION    | semisync_master.so | GPL     | |  rpl_semi_sync_slave      | active   | replication     | semisync_slave.so  | GPL    |   mysql> show variables like  '%semi% '; +-------------------------------------------------- ------+-------+| variable_name                       | value |+------------------------------ ---------------------------+-------+| rpl_semi_sync_master_enabled        | off   | |  rpl_semi_sync_master_timeout       | 10000 | |  rpl_semi_sync_master_trace_level   | 32    | |  rpl_semi_sync_master_wait_no_slave | on    | |  rpl_semi_sync_slave_enabled        | off   | |  rpl_semi_sync_slave_trace_level    | 32    |+-------------- -------------------------------------------+-------+6 rows in set  (0.00 sec)


4. enable half-sync

Master node enables half-sync with a time-out of 10S

SET GLOBAL rpl_semi_sync_master_enabled = 1; SET GLOBAL rpl_semi_sync_master_timeout = 10000;

Enable half-sync from the node, restart the copy thread to take effect set GLOBAL rpl_semi_sync_slave_enabled = 1; STOP SLAVE Io_thread; START SLAVE Io_thread;


5. confirm that the half-sync is active

Show global status like ' rpl% ';


6. Persistent Parameters

On the master:[mysqld]rpl_semi_sync_master_enabled=1rpl_semi_sync_master_timeout=1000 # 1 secondOn each SLAVE:[MYSQLD ]rpl_semi_sync_slave_enabled=1


This article is from the "ROIDBA" blog, make sure to keep this source http://roidba.blog.51cto.com/12318731/1893359

MySQL5.6 semi-synchronous replication to ensure database consistency

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.