errmsg" : "No host described in new configuration 1 for replica set rs0 maps to this node", Why I am getting this message?

Shashank picture Shashank · Mar 23, 2015 · Viewed 17.9k times · Source

I am getting this message every time I do rs.initiate() :

No host described in new configuration 1 for replica set rs0 maps to this node

This is how my /etc/hosts/ file looks on both the replica set servers.

Server 1 and server 2 "hosts" file

127.0.0.1 localhost
aa.bb.cc.dd DataMongo1
ee.ff.gg.hh DataMongo2

Server 1-mongod.conf file

bind-ip aa.bb.cc.dd

Server 2 -mongod.conf file

bind-ip ee.ff.gg.hh

changed server1 hostname to DataMongo1 and server2 to DataMongo2

$hostname DataMongo1

Port 27071 is uncommented on both servers

ReplicaSet config file:

cfg= {
_id:"rs0",
members:[{_id:0,host:"DataMongo1:27071"},{_id:1,host:"DataMongo2:27071"}]}

Please help me with this issue.

Answer

noam picture noam · May 28, 2019

Looks like the port is wrong. The default port of MongoDB is 27017, not 27071.