Error in Log (ReplicaSetMonitor-TaskExecutor)

Hi, I am new to Mongo and I have encountered this error in the log of a newly installed database;

:27017","error":"HostUnreachable: Error connecting to mongo3:27017 (127.0.0.1:27017) :: caused by :: Connection refused","replicaSet":"bart","isMasterReply":"{}"}}
{"t":{"$date":"2021-03-01T20:01:18.991+01:00"},"s":"I",  "c":"NETWORK",  "id":4712102, "ctx":"ReplicaSetMonitor-TaskExecutor","msg":
"Host failed in replica set","attr":{"replicaSet":"bart","host":"mongo3:27017","error"
:{"code":6,"codeName":"HostUnreachable","errmsg":"Error connecting to mongo3:27017 (127.0.0.1:27017) :: caused by :: Connection refused"},
"action":{"dropConnections":true,"requestImmediateCheck":false,"outcome":{"host":"mongo3:27017","success":false,"errorMessage":"HostUnreachable: 
Error connecting to mongo3:27017 (127.0.0.1:27017) :: caused by :: Connection refused"}}}}

From what I understand the error is that access is denied by ip 127.0.0.1. In mongod.conf, bindIp is defined: 102.101.232.214.

  1. What is the cause of this error, how can it be solved?

  2. Can I include multiple ips (add 127.0.0.1) in bindip parameter?

Thanks indeed
Antonio

Welcome to the Community!

Yes you can add multiple IP’s

--bind_ip <hostnames|ipaddresses|Unix domain socket paths>

Add localhost,IP,127.0.0.1 and see
Where is your mongod running?Locally or hosted elsewhere
Can you connect locally by shell
Could be firewall issues or bindip not setup properly

Hi Ramachandra_Tummala

I have included in the variable bind_id with the two ips, the old one plus the 127.0.0.1

bindIp: 127.0.0.1, xxx.xxx.xxx.xxx

The error has disappeared. What I don’t know is why it used 127.0.0.1 to connect to the instance and where it got that IP from.

Thanks indeed
Antonio NAVARRO

From your logs it looks like you have replication enabled. Could be a request from another node(unlikely for 127.0.0.1) or from itself.

Chris,

This is a replicaset, yesterday we saw that / etc / hosts has an entry with the name of the machine and the IP 127.0.0.1 configured.

Thanks