背景知识:在这份出色的指南之后,我在Master-Master基于行的复制(RBR)中设置了两个MySQL 5.1服务器。我希望复制所有数据库,并将定期添加新数据库。
目标:通过将数据库添加到其中一台服务器,我希望能够将新数据库添加到复制中。 无需停止两个从站,也无需更改配置文件,重新启动MySQL服务器,然后再次启动从站。
问:从我读过,我想我可以通过简单的漏报任何一个做到这一点binlog-do-db
,binlog-ignore-db
,replicate-do-db
,并replicate-ignore-db
在每个服务器的配置设置,但我不能肯定。MySQL的有关如何评估数据库级和表级复制选项的文档使我认为可能根本无法实现这一目标。
我/etc/mysql/my.cnf
文件的相关部分复制如下。我在正确的轨道上吗?我想要的甚至有可能吗?
硕士1:
[mysqld]
binlog-format = row
server-id = 1
replicate-same-server-id = 0
auto-increment-increment = 2
auto-increment-offset = 1
master-host = <master2_ip>
master-user = slave_user
master-password = <password>
master-connect-retry = 60
log-bin = /var/log/mysql/mysql-bin.log
relay-log = /var/lib/mysql/slave-relay.log
relay-log-index = /var/lib/mysql/slave-relay-log.index
expire_logs_days = 14
max_binlog_size = 2048M
硕士2:
[mysqld]
binlog-format = row
server-id = 2
replicate-same-server-id = 0
auto-increment-increment = 2
auto-increment-offset = 2
master-host = <master1_ip>
master-user = slave_user
master-password = <password>
master-connect-retry = 60
log-bin = /var/log/mysql/mysql-bin.log
relay-log = /var/lib/mysql/slave-relay.log
relay-log-index = /var/lib/mysql/slave-relay-log.index
expire_logs_days = 14
max_binlog_size = 2048M