Can't use localhost as shard, since all shards have to communicate. either use all shards and configdbs in localhost or all in real IP host

mongos> sh.addShard("rs0/delhivery-tech:27017,delhivery-tech:27018,delhivery-tech:27019");

{
    "ok" : 0,
    "errmsg" : "can't use localhost as a shard since all shards need to communicate. either use all shards and configdbs in localhost or all in actual IPs  host: delhivery-tech:27017 isLocalHost:0"
}

      

I am running 3 instances on one host with a different port. This is a testing system. I created replica set

named rs0

. Now I add shard

. It shows the instances are running on localhost

. Even I tried with ip and loopback ip as well.

It would be great if someone can help me with the same

+3


source to share


1 answer


I think you used "localhost" when you registered your config server (--configdb). Can you make sure you start your mongos with hostname? Something like

mongos --configdb delhivery-tech:27019



I invite you to take a look at the first paragraph on this page: http://docs.mongodb.org/manual/tutorial/deploy-shard-cluster/

PS: When you have a problem with your cluster (replica set and / or shard) it is good to show the status / configuration. (rs.status () or sh.status ()). This will help people understand your topology and give a better answer.

+7


source







All Articles