如何保持多个mysql数据库中的行同步?最好有教义
如果有的话,什么是保持不同数据库(可能在不同机器上)同步的行的好方法?
为了清楚起见。我有多个 mysql 数据库,它们共享具有相同架构的用户表。有一个“主”数据库,它有自己独特的架构,但包含包含所有用户记录的用户表。然后有多个“从属”数据库,它们大部分共享相同的模式,还包含用户表(具有相同的模式)并存储用户记录的子集。
当对任何数据库中的用户记录实例进行更新时,我希望该更改也传播到其所在的所有数据库中该用户记录的所有实例。
我正在使用 mysql、php5.3 和doctrine 1.2.x对于 orm,在 ubuntu VPS 服务器上运行。
What is, if there is, a good way to keep a row in to separate databases (possibly on different machines) in sync?
For clarity. I have multiple mysql databases who share a user table with the same schema. There is a "master" database that has it's own unique schema, but contains the user table which contains all user records. Then there are multiple "slave" databases who for the most part share the same schema, that also contains the user table (with the same schema) with stores a subset of user records.
When an update is made to an instance of the user record in any database I want that change propagated to too all instances of that user record in all databases it is in.
I'm using mysql, php5.3, and doctrine 1.2.x for an orm, running on ubuntu VPS servers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不要尝试使用 PHP 或 Doctrine 来执行此操作:查看 MySQL 复制< /a> 保持从数据库表与主数据库同步
Don't try to do this using PHP or Doctrine: look to MySQL replication to keep the slave database tables in synch with the master
听起来您正在寻找 MySQL 复制 并且具体而言,
replicate- do-table
配置选项,用于限制从属数据库仅关心主数据库的特定表。It sounds like you're looking for MySQL replication and in specific, the
replicate-do-table
configuration option to restrict the slave databases to only caring about specific table(s) from the master.