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: