Mongo accepting connection but compass fails to connect

Viewed 163

Compass fails to connect to MongoDb Server although I can see that the connection is accepted in the console and while mongo is set to listen to the right ip and port. (0.0.0.0 27017)

I have setup MongoDb in an LXD container (running on CentOs 7) inside a CentOs 7 server and I have successfully setup port forwarding from the host to the container using the following command:

lxc config device add mycontainer mongoport proxy listen=tcp:0.0.0.0:27017 connect=tcp:0.0.0.0:27017

while running MongoDb without authentication in the container using the command mongod --bind_ip 0.0.0.0 I can see that when Compass tries to make a connection to the server, the connection is actually accepted:

2019-10-16T07:33:51.008+0000 I  NETWORK  [listener] connection accepted from 127.0.0.1:41674 #1 (1 connection now open)

However, Compass fails to connect as it shows the following message:

Server selection timed out after 10000 ms

I am not running MongoDb with any particular configuration, and since the connection is accepted, what could go possibly wrong and cause this problem? what is the solution?

Update:

I tried disabling SElinux but it seems it has nothing to do with it.

0 Answers
Related