问题描述
我试图了解MongoDB和分片的概念.如果我们从2个节点开始并对客户数据进行分区,则基于姓氏,其中A到M数据存储在节点1上,N到Z数据存储在节点2上. ?我只是看不到它将如何工作.
I'm trying to understand MongoDB and the concept of sharding. If we start with 2 nodes and partition say, customer data, based on last name where A thru M data is stored on node 1 and N thru Z data is stored on node 2. What happens when we want to scale out and add more nodes? I just don't see how that will work.
推荐答案
如果您有2个节点,并不意味着数据被分成2个大块.通过分区可以说是10个块,其中6个在服务器1上,其余在服务器2上.
If you have 2 nodes it doesn't mean that data is partitioned into 2 chunks. It can by partitioned to let's say 10 chunks and 6 of them are on server 1 ane rest is on server 2.
添加其他服务器时,MongoDB能够在新配置的节点之间重新分配这些块
When you add another server MongoDB is able to redistribute those chunks between nodes of new configuration
您可以在官方文档中阅读更多内容:
You can read more in official docs:
http://www.mongodb.org/display/DOCS/Choosing+ a + Shard + Key
这篇关于MongoDB分片,添加新节点时如何重新平衡?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!