Google云端平台 - 无法连接到mongodb [英] Google Cloud Platform - Can't connect to mongodb

查看:357
本文介绍了Google云端平台 - 无法连接到mongodb的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

刚刚在谷歌云平台上使用点击部署安装了mongodb。我有另一个项目,为此我创建了mongodb数据库,在这里我的web应用程序运行。
我是否必须打开一些端口或配置一些东西?

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 have to open some port or configure something?

推荐答案

code> mongod daemon监听TCP端口 27017 。因此,您需要在计算引擎防火墙上为此端口添加防火墙规则和协议。这可以使用 gcloud 命令工具:

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.

这篇关于Google云端平台 - 无法连接到mongodb的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆