I'm working on my project to Create a Sharded Cluster in MongoDB using Microsoft Azure Ubuntu 14.01 Virtual Machine.
I'm following this guide to create a sharded cluster: https://www.digitalocean.com/community/tutorials/how-to-create-a-sharded-cluster-in-mongodb-using-an-ubuntu-12-04-vps
It works until i tried to add shard to the cluster.
mongos> sh.addShard("shard0.example.net:27017")
{
"ok" : 0,
"errmsg" : "couldn't connect to new shard socket exception [CONNECT_ERROR] for shard0.example.net:27017"
}
PS: Then i tried to run Mongod process on shard0.example.net and tried to run the Mongo process from shard1.example.net with --host shard0.example.net and --port 27017, but it doesn't work too.
Is it possible that the problem is the connectivity between servers? How could i solve this problem ?
Thanks, Musa.
First, ping each shard primary node from the mongos
router node and make sure it's visible
ubuntu@ubuntu-azure:~$ping shard0.example.net
If it's ok and replying correctly, the next step would be revising the port numbers. Make sure that they are correctly typed.
If they're exactly the same, the third step would be to check the firewall and make sure that the ports that you're using are free and able to receive connections.