我已设置并运行 MySQL 复制:
数据库A(服务器1作为主服务器)-->数据库A(服务器Z,作为从服务器)
我现在想使用同一个从服务器(Z)作为另外两个数据库的从服务器;完全不同的数据库(例如 B 和 C),如果是数据库 A,则不是其他副本。
我遵循了这个简单的指南: https://www.digitalocean.com/community/tutorials/how-to-set-up-master-slave-replication-in-mysql
但是当涉及到将第二个数据库添加到/etc/my.cnf 中的从属服务器时,我不明白如何可以拥有多个配置文件。
基本上我想我需要从服务器上的 my.cnf 中的这两个 block ,但事情不会那么简单,对吧?
log_error="/var/log/mysql/error.log"
server-id=2
log_bin="/var/log/mysql/mysql-bin.log"
binlog_do_db=database_a
log_error="/var/log/mysql/error.log"
server-id=3
log_bin="/var/log/mysql/mysql-bin.log"
binlog_do_db=database_b
是否可能,或者我真的需要为每个我想要复制的唯一数据库配备一个新的从属服务器吗?
是否可以在从服务器上为每个数据库提供特定的conf文件,例如/etc/databasea.cnf 和/etc/databaseb.cnf 这样我就可以为每个数据库指定不同的设置?
提前致谢
最佳答案
多源复制仅适用于从 5.7.6 开始的 MySQL 或从 10.0.1 开始的 MariaDB。
Multi-Source Replication enables a replication slave to receive transactions from multiple sources simultaneously. Multi-source replication can be used to back up multiple servers to a single server, to merge table shards, and consolidate data from multiple servers to a single server. Multi-source replication does not implement any conflict detection or resolution when applying the transactions, and those tasks are left to the application if required. In a multi-source replication topology, a slave creates a replication channel for each master that it should receive transactions from.
来源:
关于MySQL 复制 - 多个主服务器(不同的 d/bs)复制到同一从服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31643499/