A
A
Alexander2012-10-10 17:29:02
MongoDB
Alexander, 2012-10-10 17:29:02

MongoDb sharding and further extensibility

I found an excellent guide on how to do everything sharding (something similar was even on Habré),
gliffer.ru/articles/nosql--sharding-mongodb-na-paltsah/
www.mongodb.org/display/DOCS/Sharding
blog.zawodny. com/2011/03/06/mongodb-pre-splitting-for-faster-data-loading-and-importing/

but there are a few questions left behind the scenes:

1) as I understand it, secondary keys can be sharding keys, i.e. .sharding key does not have to be unique,
for example, sharding data by regions / countries / cities

2) if we sharded data, then after some time we decided to deliver physical servers, then we can rebuild the config, reconfigure shards. That's understandable, but can I add new mongo-d instances in a way that doesn't lose data?
Example: sharding by the first letter of the alphabet:
server 1 AE
server 2 E-L
server 3 L-M
server 4 M-P
server 5 R-Y

and then it turns out that server 4 starts to overflow and you have to divide it in half:
server 4 M- About
server 6 O-P

how will data be moved in this case, which was previously located on server 4, but should now be part of server 6?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Huseynov, 2012-10-10
@kibergus

As far as I remember, load balancing is automatic. The subd itself will transfer data from overloaded servers to idle ones.

S
sevmax, 2012-10-11
@sevmax

But there is one caveat!
Chunks will be stored on server 4, meaning there will be no reduction in disk space usage. You should delete chunks older than a certain time (for example, 1 day) by cron.
This functionality will be added to mongod in the next version.
The answer about removing chunks is the official 10gen recommendation.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question