Brief description of MySQL semi-synchronous replication-semisync

Source: Internet
Author: User

MySQL's semi-synchronous replication-semisync is based on the default asynchronous replication and full synchronous replication, which is not returned to the client immediately after master executes the client-submitted transaction, but waits for at least one slave to receive and write to relay log to return to the client. Compared to asynchronous replication, Semisync improves data security, but is better than full synchronization performance, so the time between master and slave must be consistent to avoid semisync failure. MySQL's semi-synchronous plugin is provided by Google free of charge in the MySQL $basedir/lib/plugin under the corresponding dynamic library file, Linux is a. So,dos system is a. dll, by default MySQL is not loaded Semisync plug-ins, so to make semisync to manually load the plugin in the MySQL shell, the following is a simple talk about the Semisync configuration of MySQL, It is important to use MySQL's super user to configure it, and MySQL will be 5.5 and later, and it will be configured on the basis of asynchronous replication.

#master中mysql > install plugin rpl_semi_sync_master soname  ' semisync_master.so '; query ok, 0 rows affected  (0.00 sec) mysql> show global  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    | +------------------------------------ +-------+4 rows in set  (0.01 sec) mysql> set global rpl_semi_sync_ master_enabled = 1; #开启master上的semisync, set the time-out period, can be modified by setting the Rpl_semi_sync_master_timeout variable, the default unit is MS query  OK, 0 rows affected  (0.00 sec) mysql> show status like  '% rpl_semi_sync% '; +--------------------------------------------+-------+| variable_name                                | value |+------------------------------------ --------+-------+| rpl_semi_sync_master_clients                | 1     | | rpl_semi_sync_master_ net_avg_wait_time     | 565   | | Rpl_semi_sync_master_net_wait_time          | 3391  | | rpl_semi_sync_master_net_ waits             | 6      | | Rpl_semi_sync_master_no_times               | 1     | | rpl_semi_sync_master_no_tx                  |  12    | | rpl_semi_sync_master_status                 | on    | | rpl_semi_ sync_master_timefunc_failures     | 0     | |  rpl_semi_sync_masteR_tx_avg_wait_time      | 588   | | rpl_semi_sync_ master_tx_wait_time          | 3528  | |  Rpl_semi_sync_master_tx_waits               | 6     | | rpl_semi_sync_master_wait_pos_backtraverse  | 0     | | Rpl_semi_sync_master_wait_sessions          | 0     | | rpl_semi_sync_master_ Yes_tx                | 6      | +--------------------------------------------+-------+14 rows  in set  (0.00 sec) #slave中mysql > install plugin rpl_semi_sync_slave soname   ' Semisync_slaVe.so ';       query ok, 0 rows affected  (0.00  sec) mysql> show global variables like  '%semi% '; +---------------------------- -----+-------+| variable_name                    | value |+---------------------------------+-------+|  rpl_semi_sync_slave_enabled     | off   | |  rpl_semi_sync_slave_trace_level | 32    |+-------------------------------- -+-------+2 rows in set  (0.00 sec) mysql> set global rpl_semi_sync_ slave_enabled = 1; query ok, 0 rows affected  (0.00 sec) Mysql> stop slave io_ thread;start slave io_thread; #重启slave上的IO线程Query  OK, 0 rows affected  (0.09  SEC) query ok, 0 rows affected  (0.00 sec) mysql> show status like  '%Rpl_ semi_sync% '; +----------------------------+-------+| variable_name               | value |+----------------------------+-------+|  rpl_semi_sync_slave_status | on    |+----------------------------+-------+ 1 row in set  (0.00 SEC)

Such a simple semisync is configured, it is important to note that if master exceeds the timeout time does not receive slave message will automatically become asynchronous replication, of course, if you do not need Semisync can directly uninstall the corresponding plug-in

mysql> Uninstall plugin Rpl_semi_sync_master; Query OK, 0 rows Affected (0.00 sec) mysql> Uninstall plugin Rpl_semi_sync_slave; Query OK, 0 rows Affected (0.00 sec)


This article from "Technical essay" blog, declined reprint!

Brief description of MySQL semi-synchronous replication-semisync

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.