Background: I have two MySQL 5.1 servers setup in Master-Master row-based-replication (RBR) following this excellent guide. I want all databases replicated, and will be adding new databases regularly.
Goal: I would like to be able to add new databases to replication by just adding the DB to one of the servers; without having to stop both slaves, change the configuration files, restart the MySQL servers, and start the slaves again.
Question: From what I've read, I think I can do this by simply omitting any binlog-do-db
, binlog-ignore-db
, replicate-do-db
, and replicate-ignore-db
settings in each server's configuration, but I can't be sure. MySQL's docs on how Database- and Table-level replication options are evaluated make me think there might be no way to accomplish this at all.
Relevant portions of my /etc/mysql/my.cnf
files are copied below. Am I on the right track? Is what I want even possible?
Master 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
Master 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