2 / 3
Jul 2024

Hi Team,

I have 4 VMs, each installed with MongoDB 6.0, and the firewalls on all VMs are disabled. The MongoDB configuration files on all 4 VMs have the bindIP set to 0.0.0.0, allowing remote access. I can connect to MongoDB on the first VM from the second VM, indicating that remote access is enabled.

I followed the process to create a config server, router server, shard 1 server, and shard 2 server. However, when I try to connect from the Mongo router to the Mongo config server, I get the following error:

query: mongos --configdb config/config server ip:27017 Error: {“t”:{“$date”:“2024-07-12T20:57:08.441+05:30”},“s”:“I”, “c”:“-”, “id”:4333222, “ctx”:“ReplicaSetMonitor-TaskExecutor”,“msg”:“RSM received error response”,“attr”:{“host”:“localhost.localdomain:27017”,“error”:“HostUnreachable: Error connecting to localhost.localdomain:27017 (127.0.0.1:27017) :: caused by :: Connection refused”,“replicaSet”:“config”,“response”:{}}} {“t”:{“$date”:“2024-07-12T20:57:08.442+05:30”},“s”:“I”, “c”:“NETWORK”, “id”:4712102, “ctx”:“ReplicaSetMonitor-TaskExecutor”,“msg”:“Host failed in replica set”,“attr”:{“replicaSet”:“config”,“host”:“localhost.localdomain:27017”,“error”:{“code”:6,“codeName”:“HostUnreachable”,“errmsg”:“Error connecting to localhost.localdomain:27017 (127.0.0.1:27017) :: caused by :: Connection refused”},“action”:{“dropConnections”:true,“requestImmediateCheck”:false,“outcome”:{“host”:“localhost.localdomain:27017”,“success”:false,“errorMessage”:“HostUnreachable: Error connecting to localhost.localdomain:27017 (127.0.0.1:27017) :: caused by :: Connection refused”}}}}

This error keeps running continuously until I use Ctrl+C to forcefully stop it.

please help to fix this error.

Thanks & Regards
Aravind

Share the configuration files of your config servers.

Means that no process is listening to the given port at the given address.

In your case, it means the config server is not listening to port 27017 or is not running on localhost.