Access remote server mongo with compass

Hello,

i have a server php with mongodb
All is working :

  • mongosh is ok and i can scoot db and collection via cli
  • access mongodb via php is ok and i can get/set collection

But : i can’t access to db via compass

I use this :
mongodb://user:mdp@hostname ( exactly like my php )

And compas return me a timeout error.

I don’t understand why…
I have check net.bindip and i have 2 ip set ( my localhost and ip remote server )

Thanks to advance

You probably don’t have mongod configured to accept connections via the external TCP/IP interface.

Ok thanks Jack to give me the road to solution

So, the probleme it was that i need to add my ip local machine to ip list authorized to listening :27017

The doc exact for me is : https://www.mongodb.com/docs/v6.0/tutorial/configure-linux-iptables-firewall/

And i had just plat this line :

iptables -A INPUT -s <ip-address> -p tcp --destination-port 27017 -m state --state NEW,ESTABLISHED -j ACCEPT

I hope it was not a mistake but anyway : now compass connection is ok

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.