数据库多主一丛复制

Netkiller MySQL 手札

MySQL MariaDB...

Mr. Neo Chan, 陈景峰(BG7NYT)


中国广东省深圳市龙华新区民治街道溪山美地
518131
+86 13113668890
+86 755 29812080

文档始创于2010-11-18

版权声明

转载请与作者联系,转载时请务必标明文章原始出处和作者信息及本声明。

文档出处:
http://netkiller.github.io
http://netkiller.sourceforge.net

$Date: 2013-04-10 15:03:49 +0800 (Wed, 10 Apr 2013) $

 

1.3.4. multi-master replication

MySQL 5.7 以上版本才能使用

		
 master1  ---------> master2
    ^                   |
    |                   |
    |                   |
    |                   V
 master4  <--------- master3
 		
		

1.3.5. multi-source replication

MySQL 5.7 以上版本才能使用

		
 master1    master2    master3    master4
    |          |          |          |
    |          |          |          |
    |          |          |          |
    `--------------------------------'
                    |
                    V
                  Slave
 		
		

slave 配置

		
slave> change master to master_host="172.16.0.1", master_port=3306, master_user="replication",master_password="password" for channel="master1";
slave> change master to master_host="172.16.0.2", master_port=3306, master_user="replication",master_password="password" for channel="master2";

slave> start slave for channel="master1";
slave> start slave for channel="master2";
		
		

检查从服务器状态

		
slave > SHOW SLAVE STATUS FOR CHANNEL="master1"\G
slave > SHOW SLAVE STATUS FOR CHANNEL="master2"\G		
		
		

测试,分别在两个主服务器上创建数据库,然后查看从数据库同步结果.

		
master1 > create database master1;
master2 > create database master2;

slave > show databases like 'master%';
+--------------------+
| Database (master%) |
+--------------------+
| master1            |
| master2            |

猜你喜欢

转载自netkiller-github-com.iteye.com/blog/1953030
今日推荐