Google Cloud Platform - Can't connect to mongodb

后端 未结 5 1163
夕颜
夕颜 2020-12-20 14:53

Just installed mongodb using click-to-deploy in google cloud platform. I have another project, for which I created the mongodb database, where my web application runs. Do I

5条回答
  •  感情败类
    2020-12-20 15:42

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

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

    It is recommended to use target tag with the firewall rule and use this target tag to specify what VM instances the firewall rule should be applied to.

提交回复
热议问题