Google cloud platform - unable to connect to mongodb

Mongodb has just been installed, using a click to deploy to the Google cloud platform. I have another project for which I created the mongodb database where my web application runs. Do I need to open some port or configure something?

+5
source share
4 answers

As the other answers in this thread show, the mongod daemon mongod listening on TCP port 27017 . Therefore, you need to add a firewall rule to the Compute Engine firewall for this port and protocol. This can be done using the Google Cloud console or using the gcloud tool:

 gcloud compute firewall-rules create allow-mongodb --allow tcp:27017 

It is recommended that you use the target tag with the firewall rule and use this target tag to indicate which instances of the virtual machine should be applied to the firewall rule.

+4
source

Check the Http or Https checkbox to activate the external IP address so you can use it to access the database

0
source

In a Mongodb project, you must open a firewall for port 27017.

The MongoDB ports used are listed on:
http://docs.mongodb.org/manual/tutorial/configure-linux-iptables-firewall/

Respectfully,
Paolo

0
source

This answer explains how to set up a firewall rule for port 27017 .

Another problem that can lead to this is running your mongodb on a separate network and having other instances on the network by default (or vice versa).

I came across this and, having received both instances on the same network, was able to connect to the mongo instance by name.

Here is an example of how to configure a network for a managed virtual machine in app.yaml :

 network: instance_tag: https-server name: my-node-network 
0
source

Source: https://habr.com/ru/post/1214354/


All Articles