We tried to outline a large collection in mongodb 2.4.9 with 3 replica sets (rs1, rs2, rs3). Currently, all data is on rs1.
We have 3 configuration servers on which the overlay is launched and enabled using:
sh.enableSharding("test")
Then we selected the fragment key and placed the collection:
sh.shardCollection("test.fs.chunks", { files_id : 1 , n : 1 } )
After that, we added additional shards:
sh.addShard( "rs2/mongo2:27017" )
sh.addShard( "rs3/mongo3:27017" )
However, after 4 days, all data is still on rs1. Considering the configuration, the database we are building is listed as "partitioned = true":
{ "_id" : "test", "partitioned" : true, "primary" : "rs1" }
However, when we execute db.fs.chunks.getShardDistribution (), we are given an error indicating that the collection is not sealed:
mongos> db.fs.chunks.getShardDistribution()
Collection test.fs.chunks is not sharded.
Then we tried to reissue the shardCollection command and get an error message:
mongos> sh.shardCollection("test.fs.chunks", { files_id : 1 , n : 1 } )
"code" : 13449,
"ok" : 0,
"errmsg" : "exception: collection test.fs.chunks already sharded with 33463 chunks"
3 . mongos , /, .
- - , - ?
Dave