Mongodb – Help – Error : Could not connect to master of shard replica set

mongodbsharding

I have a shard, using mongo v2.4.11. It has to mongos, 3 config, and 8 replica set (2 replica for each set, means 16 node for shard)

It is keep having exception as per below.

Caused by: com.mongodb.MongoException: can't connect to new replica set master [shardA01:27017], err: couldn't connect to server shardA01:27017

I try to look for anyone who might has similar issue, but i found nothing. This happens about 1 of 1000 request.

All node of shard is hosted using aws virtual servers.

What i have done is
– check CPU and memory but everything is fine, not even > 10% of usage
– set master priority to one of the node.

Anyone know what the problem is? Or how to further investigate the issue?

Best Answer

the problem seems to be the version of mongodb. Somehow for mongodb < 2.6 socket problem will intermittently occurs. When it occurs, you have to restart your mongos node.