Semi-synchronous replication in MySQL master-slave Replication

Source: Internet
Author: User

Semi-synchronous replication in MySQL master-slave Replication

Experiment MySQL uses the plug-in provided by Google to complete the semi-synchronous replication model; the physical machine is still Windows 7, and the virtual machine is CentOS 7;

Master node: 192.168.255.2

Slave node: 192.168.20.3

Configure the master slave replication model first:

On the master node:

# Vim/etc/my. cnf

Slave node:

# Vim/etc/my. cnf

Start the myslq service at two nodes:

# Systemctl start mariadb. service

On the master node:

Configure an account with the copy permission:

> Grant replication slave, replication client on *. * TO 'repluser' @ '2017. 192.% 'identified by 'replpass ';

> Flush privileges;

Note: If you want to create an account with the copy permission on the slave server, you must first enable the master-slave settings and then execute this command:

View the location of the binary log transaction:

On the slave node:

Set the synchronization location:

> Change master to MASTER_HOST = '192. 168.255.2 ', MASTER_USER = 'repluser', MASTER_PASSWORD = 'replpass', MASTER_LOG_FILE = 'master-bin.000003', MASTER_LOG_POS = 192;

The master-slave replication configuration is complete;

Install the corresponding plug-ins on the master and slave nodes respectively:

On the master node:

> Install plugin rpl_semi_sync_master SONAME 'semisync _ master. so ';

Enable semi-sync as the master node:

> Set global rpl_semi_sync_master_enabled = 1;

Slave node:

Install the slave node plug-in:

> Install plugin rpl_semi_sync_slave SONAME 'semisync _ slave. so ';

Enable semi-sync slave Node

> Set global rpl_semi_sync_slave_enabled = on;

Start slave node synchronization:

> Start slave;

Ensure that the thread of the slave node starts properly:

In this case, the semi-sync configuration of mysql master-slave replication is complete. You can demonstrate the verification;

On the master node:

After creating a new database, view the related parameter values:

Rpl_semi_sync_master_clients: Number of semi-sync nodes on the current master node. a value of 1 indicates that there is a semi-sync node;

View from node:

The above demonstrates the configuration process of semi-synchronous replication.

Implement master-slave synchronization between two MySQL Databases

MySQL master-slave synchronization in Linux -- Add a new slave Database

Use XtraBackup to build MySQL master-slave synchronization without stopping the table and locking it

MySQL master-slave synchronization configuration records

Master-slave synchronization configuration of MySQL Databases in Linux

This article permanently updates the link address:

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.