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

3

13

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.

Constantina answered 23/3, 2015 at 13:18 Comment(6)
Please edit the question to include the replica set configuration.Coles
Looks like it didn't make it in. I think the problem is likely that the hostname one of the machines is assigned in the config isn't what hostname -f returns, so the machine doesn't recognize itself.Coles
I tried doing hostname -f on server aa.bb.cc.dd and it returned DataMongo1 and on other server ee.ff.gg.hh it returned DataMongo2. But still getting same error. I also followed instruction on this website. linode.com/docs/databases/mongodb/…Constantina
i think you need to add the hostname in the hosts file Check this answerGaol
i got the same problem! I look in a system database that name "local" have collection "local.me" with 1st document have field "host"=DEKA-PC. That is my computer name, and when i view file.log: "replSet initiate got NodeNotFound No host described in new configuration 1 for replica set replica1 maps to this node while validating { _id: "replica1", version: 1, members: [ { _id: 0, host: "DEKA-PC:27018" } ] }"Undersurface
Hello Shashank, I am also facing same issue have you found any solution. then please let me know. Thanks in advance.Baneful
P
9

I just ran into this issue, and in my case the symptoms were that everything worked correctly, until I rebooted the server.

Then I would get the following error: NodeNotFound: No host described in new configuration $id for replica set $name maps to this node

Just restarting the mongodb daemon fixed it, so it couldn't be a replica set configuration issue.

After checking the logs a bit more in detail, I noticed the following error message: NETWORK [replexec-0] getaddrinfo("$name.emilburzo.com") failed: Temporary failure in name resolution -> bingo

It was trying to query the hostname before the network was fully up, and thus the replica set member didn't know it's own identity

Adding the server's FQDN hostname to /etc/hosts fixed it, e.g.:

127.0.1.1       shortname    shortname.fqdn.com
Postdoctoral answered 27/9, 2020 at 17:11 Comment(0)
C
3

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

Can answered 28/5, 2019 at 9:50 Comment(0)
P
2

if you are using mongo.conf file then initially comment "replication" section like below,

...
#operationProfiling:

# replication:
#   replSetName: rs0-here

#sharding:
...

Now run mongod and configure replica set on mongo terminal like below,

rs.initiate({_id: "rs0-here", version: 1, members: [{ _id: 0, host : "your_host:27017" }]})

You can also create users and databases here and then exit out of it. Uncomment the following section in mongo.conf,

 replication:
   replSetName: rs0-here

run mongod again and then this issue should go away.

Pappano answered 16/3, 2021 at 17:45 Comment(1)
In my case, when I run with commented replication config, the initiate command shows error "it was not started replication enabled." So I just restart with uncommented config and run the initiate config then it worked. Kinf of a bit different with previous version because it was worked just with rs.initiate() but now it needs the object with _id & version.Groff

© 2022 - 2024 — McMap. All rights reserved.