Percona MySQL5.6 semi-synchronous Replication

Source: Internet
Author: User
Tags percona

Percona MySQL5.6 semi-synchronous Replication

Configure normal clone first

Two servers, one master and one slave

Master Server:

10.10.1.30

Slave:

10.10.1.200

Modify the my. cnf file of each machine and the server_id

Master server server_id = 1, slave server_id = 2

Restart the two servers and run the following command:

Show variables like 'server _ id ';

The server_id of the two servers is different.

Log on to the Master and enter:

Grant replication slave on *. * to 'repl' @ '10. 10.1.200 'identified by 'Password ';
Flush privileges;
Show master status;

Record the File and Postion fields of the master node for future use.

Log on to Slave and enter:

Mysql> change master
-> Master_host = '10. 10.1.30 ',
-> Master_port = 3306,
-> Master_user = 'repl ',
-> Master_password = 'Password ',
-> Master_log_file = 'bin-file.000035', // The File field of the Master.
-> Master_log_pos = 407; // The Postion field of the Master.

Mysql> start slave;
Query OK, 0 rows affected (0.03 sec)

Input: show slave status \ G
If no error message is reported, the clone configuration is complete.

Now configure semi-synchronous replication:

Check whether the plug-in of semi-synchronous replication exists. Generally, the plug-in of version 5.6 comes with the plug-in.

To:/usr/lib64/mysql/plugin, check whether the following exists:

[Root @ localhost plugin] # ll-h semisync _*
-Rwxr-xr-x. 1 root 40 K Sep 15 00:16 semisync_master.so
-Rwxr-xr-x. 1 root 14 K Sep 15 00:16 semisync_slave.so

Then log on to the Master and enter:

Install plugin rpl_semi_sync_master soname 'semisync _ master. so ';


Log on to the Slave and enter:

Install plugin rpl_semi_sync_slave soname 'semisync _ slave. so ';

These two files. Then add the following to the my. cnf file of the Master:

Rpl_semi_sync_master_enabled = 1
Rpl_semi_sync_master_timeout = 3000
Rpl_semi_sync_master_trace_level = 32
Rpl_semi_sync_master_wait_no_slave = on

Binlog_format = ROW
Binlog_row_image = minimal

In the my. cnf file of Slave, add:

Rpl_semi_sync_slave_enabled = 1
Slave-parallel_workers = 4

Binlog_format = ROW
Binlog_row_image = minimal

Finally, the slave-parallel_worker parameters can increase the slave working thread to improve performance. Binlog_format is safer to use the row format. If the image is set to minimal, binlog only records the affected rows.
Both servers can be restarted.

Then, you can enter the following on the master or slave:

Show global variables like 'rpl _ semi % ';

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.