简体   繁体   English

数据库复制

[英]Database replication

OK when working with table creation, is it always assumed that creating a table on one database (the master) mean that the DBA should create the table on the slave as well? 在进行表创建时可以,是否总是假设在一个数据库(主数据库)上创建表意味着DBA也应在从数据库上创建表? Also, if using a master/slave configuration, shouldn't data always be getting replicated from the master to the slave to synch? 另外,如果使用主/从配置,是否不应该总是将数据从主复制到从中进行同步?

Right now the problem I am having is my database has a lot of stuff in the master, but the slave is missing parts that only exist in the master. 现在,我遇到的问题是我的数据库中的主数据库中有很多东西,但是从数据库缺少仅存在于主数据库中的部分。 Is something not configured correctly here? 这里配置不正确吗?

I prefer to rely on CREATE TABLE statements being replicated to set up the table on the slave, rather than creating the slave's table by hand. 我更喜欢依靠复制的CREATE TABLE语句在从属服务器上设置表,而不是手工创建从属服务器的表。 That, of course, relies on the DBMS supporting this. 当然,这依赖于支持此功能的DBMS。

If you have data on the master that isn't on the slave, that's some sort of failure of replication, either in setup or operationally. 如果主服务器上的数据不在从服务器上,那么在安装或操作上这都是某种复制失败。

Depends how the replication is configured. 取决于复制的配置方式。 Real time replication should keep the master and slave in sync at all times. 实时复制应始终使主服务器和从服务器保持同步。 "Poors mans" replication is usually configured to sync upon some time interval expiring. 通常将“穷人”复制配置为在某个时间间隔到期时进行同步。 This is whats probably happening in your case. 这可能是您的情况。

Any table creation on master is replication on slave. 在主服务器上创建的任何表都是在从属服务器上的复制。 Same goes with the inserting data. 插入数据也是如此。 Go through the replication settings in my.cnf file for mysql and check if any database / table is ignored from replicating. 仔细检查mysql的my.cnf文件中的复制设置,然后检查是否从复制中忽略了任何数据库/表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM