FAQ: Replication and Replica Sets常见问题解答:复制和副本集

On this page本页内容

This document answers common questions about replication in MongoDB. 本文档回答了有关MongoDB中复制的常见问题。See also the Replication section in the manual, which provides an overview of replication, including details on:另请参阅手册中的复制部分,该部分概述了复制,包括以下详细信息:

What kind of replication does MongoDB support?MongoDB支持哪种复制?

MongoDB supports replica sets, which can have up to 50 nodes.MongoDB支持副本集,最多可以有50个节点

Does replication work over the Internet and WAN connections?复制是否通过Internet和WAN连接工作?

Yes.

For example, a deployment may maintain a primary and secondary in an East-coast data center along with a secondary member for disaster recovery in a West-coast data center.例如,部署可以在东海岸数据中心维护一个primary和一个secondary,以及在西海岸数据中心进行灾难恢复。

Can MongoDB replicate over a "noisy" connection?MongoDB能否通过“嘈杂”连接进行复制?

Yes, but not without connection failures and the obvious latency.是的,但并非没有连接故障和明显的延迟。

Members of the set will attempt to reconnect to the other members of the set in response to networking flaps. 集合的成员将尝试重新连接到集合的其他成员,以响应网络襟翼。This does not require administrator intervention. 这不需要管理员干预。However, if the network connections among the nodes in the replica set are very slow, it might not be possible for the members of the node to keep up with the replication.但是,如果副本集中节点之间的网络连接非常缓慢,则节点的成员可能无法跟上复制。

Tip提示
See also: 参阅:

Why use journaling if replication already provides data redundancy?如果复制已经提供了数据冗余,为什么要使用日志记录?

Journaling facilitates faster crash recovery.日志记录有助于更快的崩溃恢复。

Journaling is particularly useful for protection against power failures, especially if your replica set resides in a single data center or power circuit.日志记录对于防止电源故障特别有用,尤其是当副本集位于单个数据中心或电源电路中时。

When a replica set runs with journaling, you can safely restart mongod instances without additional intervention.副本集运行日志记录时,您可以安全地重新启动mongod实例,而无需额外干预。

Note注意

Journaling requires some resource overhead for write operations. 日志记录需要一些写操作的资源开销。Journaling has no effect on read performance, however.然而,日志记录对读取性能没有影响。

Journaling is enabled by default on all 64-bit builds of MongoDB v2.0 and greater.默认情况下,MongoDB v2.0及更高版本的所有64位版本均启用日志记录。

What information do arbiters exchange with the rest of the replica set?仲裁器与副本集的其余部分交换什么信息?

Arbiters never receive the contents of a collection but do exchange the following data with the rest of the replica set:仲裁器从不接集合合的内容,但会与副本集的其余部分交换以下数据:

  • Credentials used to authenticate the arbiter with the replica set. 用于使用副本集对仲裁器进行身份验证的凭据。These exchanges are encrypted.这些交换是加密的。
  • Replica set configuration data and voting data. 副本集配置数据和投票数据。This information is not encrypted. 此信息未加密。Only credential exchanges are encrypted.只有凭证交换被加密。

If your MongoDB deployment uses TLS/SSL, then all communications between arbiters and the other members of the replica set are secure.如果MongoDB部署使用TLS/SSL,那么仲裁器和副本集其他成员之间的所有通信都是安全的。

See the documentation for Configure mongod and mongos for TLS/SSL for more information. 有关更多信息,请参阅配置mongodmongos for TLS/SSL的文档。As with all MongoDB components, run arbiters on secure networks.与所有MongoDB组件一样,在安全网络上运行仲裁器。

Is it normal for replica set members to use different amounts of disk space?副本集成员使用不同数量的磁盘空间是否正常?

Yes.

Factors including: different oplog sizes, different levels of storage fragmentation, and MongoDB's data file pre-allocation can lead to some variation in storage utilization between nodes. 因素包括:不同的oplog大小、不同级别的存储分片以及MongoDB的数据文件预分配可能会导致节点之间的存储利用率有所不同。Storage use disparities will be most pronounced when you add members at different times.当您在不同时间添加成员时,存储使用差异将最明显。

Can I rename a replica set?我可以重命名副本集吗?

Yes, unsharded replica sets can be renamed. 是的,可以重命名未共享的副本集。This procedure requires downtime.此过程需要停机。

To learn how to rename your replica set, see Rename a Replica Set.要了解如何重命名副本集,请参阅重命名副本集

Before renaming a replica set, perform a full backup of your MongoDB deployment.重命名副本集之前,请执行MongoDB部署的完整备份

←  FAQ: Sharding with MongoDBFAQ: MongoDB Storage →