1
votes

I have installed and running mongodb on port 27017 of my VM on gcp. But I am not able to access database from my pc or any external client.

I have set firewall rules to allow ingress traffic with tcp protocol on port 27017(tcp:27017) from all ip ranges(0.0.0.0/0) and have set priority 1000. firewall rules snapshot

Now when i am trying to access the database from external client I am not able to access it. I even tried mongodb compass and used ip address of VM and port 27017 to access the database. But unable to connect and showing(mongodb not running on provided host and port) however I am able to access to database when accessed from that VM itself in which I have installed the mongodb. Please suggest if I am missing out anything.

2

2 Answers

0
votes

Add --bind_ip_all to mongodb server start command.

0
votes

By default, MongoDB doesn’t allow remote connections. So I would suggest you follow this tutorial to resolve your issue.

Let me know if this was helpful.