Using MongoDB 2.6, I've setup four replication sets: a, b, c & d:
>rs.conf()
a:PRIMARY> rs.conf()
{
"_id" : "name_of_replset",
"version" : 1,
"members" : [
{
"_id" : 0,
"host" : "fedora_cje:port_number"
},
{
"_id" : 1,
"host" : "fedora_cje:port_number"
},
{
"_id" : 2,
"host" : "fedora_cje:port_number"
}
]
}
Those replication sets have been added to shards
>sh.status()
shards:
{ "_id" : "a", "host" : "a/fedora_cje:27000,fedora_cje:27001,fedora_cje:27002" }
{ "_id" : "b", "host" : "b/fedora_cje:27100,fedora_cje:27101,fedora_cje:27102" }
{ "_id" : "c", "host" : "c/fedora_cje:27200,fedora_cje:27201,fedora_cje:27202" }
{ "_id" : "d", "host" : "d/fedora_cje:27300,fedora_cje:27301,fedora_cje:27302" }
At the bottom of sh.status(), I am seeing this message
{ "_id" : "test", "partitioned" : false, "primary" : "d" }
{ "_id" : "test_collection", "partitioned" : false, "primary" : "d" }
but test and test_collection don't exist in the test_cluster database.
Inserting records, the fourth replication set and fourth shard are apparently ignored.
test_cluster.test_cluster_collection.stats()
"nchunks" : 3,
"shards" : {
"a" : {...
"b" : {...
"c" : {
Notice also that the number of chunks remains at 3.
I am using the default /etc/mongod.conf file.
This is the insert statement being used:
>use test_cluster
>t=db.test_cluster.test_sharded_collection
>for( var i=0; i < 20000; i++ ){t.insert( { x:i,y:3,z:"test test" } )}
Question: Why is the fourth replication set and consequently the fourth shard being ignored during inserts?