Friday, 15 February 2013

sharding - MongoDB presplitting chunks for compound shard key -



sharding - MongoDB presplitting chunks for compound shard key -

in mongodb setup have compound shard key {"region" : 1, "foo" : 1, "bar" : 1} , know values part can , each part should on 1 chunk.

therefore i'd pre-split based on part key only. sharding status should afterwards:

{ "region": { "$minkey" : 1 }, "foo": { "$minkey" : 1 }, "bar": { "$minkey" : 1 } } -> { "region": region1, "foo": { "$minkey" : 1 }, "bar": { "$minkey" : 1 } } on: shard1 { "region": region1, "foo": { "$minkey" : 1 }, "bar": { "$minkey" : 1 } } -> { "region": region2, "foo": { "$minkey" : 1 }, "bar": { "$minkey" : 1 } } on: shard2 { "region": region2, "foo": { "$minkey" : 1 }, "bar": { "$minkey" : 1 } } -> { "region": { "$maxkey" : 1 }, "foo": { "$minkey" : 1 }, "bar": { "$minkey" : 1 } } on: shard3

i've tried ways accomplish that, nil worked:

db.runcommand( { split : "mydb.mycollection" , middle : { "region" : "region1" } } ); homecoming error, because finish shard key have part of split. db.runcommand( { split : "mydb.mycollection" , middle : { "region" : "region1", "foo" : { "$minkey" : 1 }, "bar" : { "$minkey" : 1 } } } ); , db.runcommand( { split : "mydb.mycollection" , middle : { "region" : "region1", "foo" : "$minkey" , "bar" : "$minkey" } } ); interpret minkey string , split on base of operations wrong.

how can split chunks compound shard key on single field base?!

cheers.

mongodb sharding

No comments:

Post a Comment