Mongodb-在数据库或集合级别设置复制 [英] Mongodb - Setting the replication at the db or collection level

查看:60
本文介绍了Mongodb-在数据库或集合级别设置复制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我经历了以下阶段,对分布式系统(例如hdfs和elasticsearch等)有了很好的认识.

I come across the following phase and I had fair idea of distributed systems like hdfs and elasticsearch etc ..

MongoDB中的副本集是一组维护的mongod进程相同的数据集.副本集提供冗余和高可用性,并且是所有生产部署的基础.这本节介绍MongoDB中的复制以及组件和副本集的体系结构.本节还提供了教程用于与副本集相关的常见任务.

A replica set in MongoDB is a group of mongod processes that maintain the same data set. Replica sets provide redundancy and high availability, and are the basis for all production deployments. This section introduces replication in MongoDB as well as the components and architecture of replica sets. The section also provides tutorials for common tasks related to replica sets.

在所有类似hdfs,elasticsearch的分布式系统中,我们可以在文件级别或索引级别设置复制因子.似乎无法使用mongo db,使用mongodb复制的唯一方法是在 instance/process 级别-这意味着无论副本集组中的机器将具有相似的数据什么.

In all those distributed systems like hdfs , elasticsearch - we can set the replication factor at the file level or index level. It seems it is not possible to do with mongo db, the only way to do the replication with mongodb is at the instance / process level - which means the machines in the replicaset group will have similar data no matter what.

是否可以在 db 级别创建复制?

Isnt it possible to create the replication at the db level ?

推荐答案

在MongoDB副本集中,每个文档都存储在每个节点上(因此复制因子是节点数,并且不可配置).

In a MongoDB replica set, each document is stored on each node (hence the replication factor is the number of nodes, and it is not configurable).

这种设计的好处是每个节点都可以从其本地存储的数据中回答任何查询,而无需从其他节点检索数据.

The benefit of this design is each node can answer any query from its locally stored data, without needing to retrieve data from other nodes.

这篇关于Mongodb-在数据库或集合级别设置复制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆