[英]Only replicate DDL in MySQL
I wonder if there is any easy way to keep the scheme consistent in two different MySQL clusters.我想知道是否有任何简单的方法可以使方案在两个不同的 MySQL 集群中保持一致。 Apart from classic replication, I would like to have a special "replication" which would reproduce all DDL queries (CREATE, ALTER, DROP, ...) on another cluster (namely the master of that cluster).
除了经典复制之外,我还想有一个特殊的“复制”,它将在另一个集群(即该集群的主集群)上重现所有 DDL 查询(CREATE、ALTER、DROP 等)。
I don't need the actual data to be replicated.我不需要复制实际数据。
Has anyone ever done or tried anything like this?有没有人做过或尝试过这样的事情?
You can filter replication in MySQL based upon the database in which a query was executed.您可以根据执行查询的数据库过滤 MySQL 中的复制。 That doesn't prevent you making changes in other databases, however;
但是,这并不妨碍您在其他数据库中进行更改; So you can do;
所以你可以这样做;
USE ddl_repl_db;
ALTER TABLE other_db.foo ADD COLUMN <etc>
This relies on you configuring your servers correctly.这取决于您正确配置服务器。 I haven't set up MySQL replication for a while, but IIRC you can both filter what you send out from the master for replication and what you accept on the slave.
我已经有一段时间没有设置 MySQL 复制了,但是 IIRC 你既可以过滤从主服务器发出的用于复制的内容,也可以过滤你在从服务器上接受的内容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.