Home > 数据库 > 如何配置MySQL SemiSyncReplication

如何配置MySQL SemiSyncReplication

SemiSyncReplication是Google提供的一个MySQL patch,作用在于保证至少有一个slave完成了数据同步。
安装的过程很简单,但是要找对路。这里提供一个传送门,看完就会编译安装了:
http://www.realzyy.com/?p=178

SemiSyncReplication需要的MySQL源码包为mysql-5.0.37.tar.gz;需要的patch为mysql-5.0.37_semisync.patch。其他的patch可以不打,但是如果选择mysql-5.0.37-patches来打补丁的话,那么记得要再打上http://www.realzyy.com/?p=178最后提到的那个小补丁。

配置也很简单,主要是三个参数:

master:

rpl_semi_sync_enabled = 1 #configures a master to use semi-sync replication.
rpl_semi_sync_timeout = 10000000 #the timeout in milliseconds for the master.

slave:

rpl_semi_sync_slave_enabled = 1 #configures a slave to use semi-sync replication. The IO thread must be restarted for this to take effect.

要特别注意rpl_semi_sync_timeout这个参数,官网推荐的设置10太短了。我测试了一下,将slave上的replication线程停掉,master上面执行更新操作并不会出现明显的block现象。如果想让master和slave时时刻刻保证一致,那么rpl_semi_sync_timeout就需要设置得很大,至少在DBA能察觉异常之前,不允许master单方面进行更新操作。

Categories: 数据库 Tags:
  1. 弦乐之花
    October 14th, 2009 at 19:24 | #1

    5.1.37上能搞吗?

  2. October 16th, 2009 at 21:57 | #2

    明天去试试  看着还不错

  3. October 21st, 2009 at 20:08 | #3

    貌似半同步的google patch只能支持5.0.37

  4. liecs
    October 27th, 2009 at 18:15 | #4

    可以自己diff出来,然后升级,哈哈~~

  5. December 3rd, 2009 at 20:09 | #5

    google的,要试试才知道效果

  6. January 4th, 2010 at 07:46 | #6

    多谢。试下马上

  1. No trackbacks yet.