Major - P3
windows 2008 R2
I setup a testing environment to test the availability of sharded Mongo cluster. Below is my setup:
1. All the Mongo components are running on the same VM
2. The cluster has 2 shard, A and B. Each shard is a replica set of 3 mongod servers
3. There are three config servers running
4. 1 mongos running
After the above setup is done, a db and a collection of the db are enabled with sharding. Shared collection is then populated with some data. By checking shard status, it is confirmed that both shards carry data in the sharded collection.
Then the following steps are taken for the sharded cluster availability test.
1. perform a select and insert operation on sharded collection. Both operations are successful.
2. Shut down a secondary node of Shard A. Then, perform a select and insert operation on sharded collection. Again both operations are successful.
3. Shut down one more secondary node of Shard A. Then, perform a select and insert operation on sharded collection. This time it fails. The error message from the shell is
"$err" : "socket exception [CONNECT_ERROR] for shardA/XXX,XXXXX,XXXXXXX",
"code" : 11002
and it is also found that the remaining node of Shard A was demoted to secondary from primary.
From the result of this test, it looks like the sharded cluster will stop working once any one of the shard in the cluster is gone.
Per Mongo documentation, it is not the expected behavior. Can you point out if there is anything wrong in my setup/steps above?