Bangalore MongoDB User Group Message Board › MongoDb sharding

MongoDb sharding

A former member
Post #: 3
How can the shards be created based on ranges(for ex: based on continent like asia..etc on seven shards).?? can any one help me out???
A former member
Post #: 9
Abhishek
Posted Jun 19, 2012 3:35 PM Link to this reply Quote in reply Report as spam

abhishekk
Bangalore, IN
Post #: 1

Though I haven't used sharded mongo cluster in production, but played on my local box.

Is your shard key good enough to distribute the load. I mean shard-key should not be of low-cardinality, otherwise the chunk size will keep increasing and won't be split.
Also you can look for mongos log and shard log for actual errors.

One more thing:
Are u using 10 node Mongo cluster, or
10 shards each with 3 Node Replica-Set = 30 node Mongo cluster ?
saikiran
Posted Jun 19, 2012 4:27 PM Link to this reply Edit Delete Quote in reply

user 50446952
Bangalore, IN
Post #: 4

How can the shards be created based on ranges(for ex: based on continent like asia..etc on seven shards).?? can any one help me out???
Abhishek
Posted Jun 20, 2012 2:34 PM Link to this reply Quote in reply Report as spam

abhishekk
Bangalore, IN
Post #: 2

In each of your document you must have one of the keys as continent with values as continent name, then you define the shard key, as this key.
It is ensured that a particular shard key stays at one shard server. When u keep inserting new documents, the chunks will be divided onto your mongo shards. Be ensured that atmost 7 chunks will be created i.e. 7 continents.

For creating shardkey for a collections:
http://www.mongodb.or...­.

Generally its not recommended to have low-cardinality shard key
Hope it helped..
saikiran
Posted Jun 20, 2012 8:22 PM Link to this reply Edit Delete Quote in reply

user 50446952
Bangalore, IN
Post #: 5

i din't get u can u explain in detail?
Abhishek
Posted Jun 21, 2012 2:48 PM Link to this reply Quote in reply Report as spam

abhishekk
Bangalore, IN
Post #: 3

The documents must contain one of the key's values as the name of the continents. For the below example that key is "cont-name".

{
"_id" : ObjectId("423523"),
"cont-name" : "Asia",
"key1" : "some value",
. . . . .
. . . . .
}

You define "cont-name" as the shard key.

For configuring shardkey for a collections:
http://www.mongodb.or...­.
db.runCommand( { shardcollection : "YourCollectionName", key : { cont-name : 1 } } )
saikiran
Posted Jun 22, 2012 9:36 PM Link to this reply Edit Delete Quote in reply

user 50446952
Bangalore, IN
Post #: 6

but it can auto shard...
i.e. if the chunks in Asia continent shard increase then some of the data or chunks in asia shard can move to other continent by default.....
How can ve overcome this problem..?????
Abhishek
Posted Jun 23, 2012 2:01 PM Link to this reply Quote in reply Report as spam

abhishekk
Bangalore, IN
Post #: 4

I think I am not able to get your question

Are u trying to make shards that are situated in different continents, or there is a key in your documents(whose value is continent's name) and u are choosing that key as the shard key ??

If the latter is correct, then chunks after some time wont split, because of the low-cardinality shard key you choose

PS : u can turn off the balancer(auto-sharding), and manually assign chunks to shards.
saikiran
Posted Jun 25, 2012 9:43 AM Link to this reply Edit Delete Quote in reply

user 50446952
Bangalore, IN
Post #: 8

yea, the latter one....

thanks a lot for the info.....


Powered by mvnForum

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy