0

MonogDB's auto-sharding distributes collections or chunks (i.e. parts of a collection) to different nodes/shards. Is it possible to configure which nodes are used for specific collections or chunks?

Example: Let's say we have the collections C1, C2 and C3 as well as nodes/shards N1, N2.

Can the sharding be configured in a way that C1 will always be stored on N1?

Can the sharding be configured in a way that chunk A of C3 will always be stored on N1?

I know that the key ranges are stored in a special config database and that a balancer process modifies this data to distribute the load. However, is it safe to modify this data manually?

2 Answers 2

0

It's strongly recommended not to edit config data by yourself. You can end up with broken database.

There's no way to pin a chunk to a shard. It's called auto-sharding for a reason :)

Theoretically, you could turn off balancer, move data to where you want it to be and modify chunk configs. But in this case, you're not able turn auto-balancing on (or it will move your "pinned" chunks).

Currently all unsharded collections reside on database's primary shard. All sharded collections are evenly (more or less) distributed across all shards. There's a ticket about moving unsharded collections to other shards, but it's not clear when (or if) it will be implemented.

0

I have the same problem and found no clear soluton to this but it seems that 10Gen is doing something in this direction:

https://jira.mongodb.org/browse/SERVER-4621 and this: https://jira.mongodb.org/browse/SERVER-939

The second one is due in November, so I guess we might see this in version 2.6.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.