Can't connect to MongoDB in Google Compute Engine from other machine

Hi all,

I am trying to connect to the MongoDB in GCE from my local machine.

First, I open the port 27017 for my GCE.

Then I follow the instruction to edit “/opt/bitnami/mongodb/mongodb.conf”

bind_ip = 0.0.0.0

And restart the MongoDB server by

sudo /opt/bitnami/ctlscript.sh restart mongodb

However, I still can’t connect to the mongodb remotely, connection timeout …
Here is the connection command I run :

mongo admin --username root -p password --host HOST_IP --port 27017

I test the 27017 port by using open port check tool, it still shows the 27017 port is closed? Can anyone help me solve this problem?

Many thanks!

Hi @yusong

Could you please double check that you followed all the steps described in the guide below in order to open the port?
https://docs.bitnami.com/google/faq/#how-to-open-the-server-ports-for-remote-access

It should work with the steps that you described.

Regards,
Fran

@fortiz My bad,

In the firewall rule, I put 0.0.0.0 instead of 0.0.0.0/0. Now it works, thank you!

Hi @yusong

I’m glad to hear that! :smile: Please, feel free to post here if you have any other question.

Regards,
Fran

I am not using bitnami but I did all security steps and nothing works. Any advice?

network interfaces

net:
port: 27017
bindIp: 0.0.0.0 # Enter 0.0.0.0,:: to bind to all IPv4 and IPv6 addresses or, alternatively, use the net.bindIpAll setting.

Hi @ezequias ,

Please note we only provide support to Bitnami related installation and configuration problems. In your case, there is such a big list of possible combinations of custom MongoDB configurations, Windows environments and networking that we can not support all of them. That’s why we only support Bitnami way of installation and config so we can do our best with our support offering.

We recommend you to ask in a more generic forum like Stack Overflow, Reddit or even the Google Cloud Platform support system.

Sorry for the inconvenience it may cause you.

Regards,
Gonzalo

Thank you for you advice and for being to polite.

Best regards
Ezequias

HI @ezequias,

Hope you can fix your issue! :slight_smile:

Regards,
Gonzalo

So do I. Nothing until now.

I can connect to 127.0.0.1 in the host but not using a real external ip.

Any advice would be great for me.

Sincerely
Ezequias Rocha

Now it’s OK @gongomgra

Hi @ezequias,

I’m glad you could fix your issue! :slight_smile: We will close this ticket as solved.

Best regards,
Gonzalo