Joomla!-开源天空

2009-01-10
您所在的位置: 首页 > Linux系统 > 基础知识 > mysql半同步主从复制

mysql半同步主从复制

Joomla! 开源天空  作者:管理员  2008-11-22 18:28
  • 摘要:本文介绍了mysql半同步复制工具。

MySQL默认的主从复制是异步的,slave读取主上的执行成功日志,在从上执行。mysql半同步复制工具将从注册为半同步slave,这时主将阻塞等待所有的从完成操作,再确认transaction。支持mysql 6.0

In MySQL 6.0, the server provided a set of interfaces to extend the feature of replication with plugins. Semi-synchronous replication components implemented the semi-synchronous replication protocol by using these interfaces. There are two plugins for semi-sync, one for the master and the other for the slave, they can be loaded and unloaded at runtime.


编译与安装:

--------------------------------
In order to build the semi-synchronous replication components, you need to first build and install the latest MySQL server 6.0, which can be found here:
     http://downloads.mysql.com/forge/replication_preview
Let's assume MySQL server is install at <MYSQL_BASEDIR>, And then following the following steps to build the components:
  bzr branch lp:~hezx/mysql-server/semi-sync-replication
  cd semi-sync-replication
  autoreconf --install --symlink
  ./configure --with-mysql=<MYSQL_BASEDIR>
  make
  sudo make install
Then go to <MYSQL_BASEDIR>/mysql_mysql, and run:
  ./mtr rpl_semi_sync
This will start the test case and if every thing goes well, the test case will pass.
INSTALL AND UNINSTALL SEMI-SYNC COMPONENTS
-------------------------------------------------------------------
Use the following command to install/uninstall the semi-sync plugins:
On master:
  INSTALL PLUGIN rpl_semi_sync_master SONAME 'libsemisync_master.so';
  UNINSTALL PLUGIN rpl_semi_sync_master;
On slave:
  INSTALL PLUGIN rpl_semi_sync_slave SONAME 'libsemisync_slave.so';
  UNINSTALL PLUGIN rpl_semi_sync_slave;
After successfully installed the plugins, now you can enable semi-sync on master and slave:
On master:
  SET GLOBAL rpl_semi_sync_master_enabled=1;
On slave:
 SET GLOBAL rpl_semi_sync_slave_enabled=1;
Setup master information by using CHANGE MASTER on slave and start slave threads, and then good luck.
Thanks:
  Mark Callaghan and Wei Li from Google who created the original patch for 5.0
Reference:
  http://forge.mysql.com/wiki/ReplicationFeatures/SemiSyncReplication
  http://forge.mysql.com/worklog/task.php?id=1720
  http://code.google.com/p/google-mysql-tools/wiki/SemiSyncReplicationDesign
  http://code.google.com/p/google-mysql-tools/wiki/SemiSyncReplication

  发表您的文章评论

您的姓名 (昵称)
标题:
评分: 很差一般较好很好
评论:
验证码:
请输入验证码