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 ( :: 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 ( :: caused by :: Connection refused"},
Error connecting to mongo3:27017 ( :: caused by :: Connection refused"}}}}

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

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

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

Thanks indeed

Welcome to the Community!

Yes you can add multiple IP’s

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

Add localhost,IP, 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


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

Thanks indeed

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


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