首页 文章

Google Cloud Mongo DB:外部IP未连接

提问于
浏览
2

我已经使用默认参数在Google Cloud上创建了一个准备好的MongoDB服务器 . 他们之间的一切都很好(有通信,我可以添加数据库和集合) . 但是,我无法在任何外部计算机上连接到MongoDB . 我在GCP中创建了防火墙规则,允许端口27017上的所有连接(“0.0.0.0./0”) .

我正在运行命令:

giuseppe@ubuntu:~$ mongo --host rs0/104.154.xx.xxx,173.255.xxx.xxx,104.197.xxx.xxx 



giuseppe@ubuntu:~$ mongo --host rs0/104.154.xxx.xxx:27017,173.255.xxx.xxx:27017,104.197.xxx.xxx:27017

我在他们两个上都得到了同样的错误 . 我不知道如何解决这个问题 .

connecting to: rs0/104.154.41.xxx,173.255.xxx.xxx,104.197.22.xxx:27017/test
2015-03-18T19:47:33.770-0500 starting new replica set monitor for replica set rs0 with seeds 104.154.41.xxx:27017,104.197.22.1xx:27017,xx.255.114.xxx:27017
2015-03-18T19:47:33.770-0500 [ReplicaSetMonitorWatcher] starting
2015-03-18T19:47:34.119-0500 changing hosts to rs0/mongo-db-jff3:27017,mongo-db-vnc4:27017 from rs0/104.154.41.246:27017,1xx.197.22.xxx:27017,173.255.1xx.xx:27017
2015-03-18T19:47:34.493-0500 getaddrinfo("mongo-db-vnc4") failed: Name or service not known
2015-03-18T19:47:34.511-0500 getaddrinfo("mongo-db-jff3") failed: Name or service not known
2015-03-18T19:47:34.512-0500 Error: connect failed to replica set rs0/104.154.xxx.xxx:27017,173.2xx.xxx.68:27017,104.197.22.xxx:27017 at src/mongo/shell/mongo.js:148

EDIT:

这是我的防火墙设置 .

1 回答

  • 2

    你是否

    • 在Google Cloud 控制台中配置防火墙规则

    • 在防火墙规则中提供标记

    • 使用与防火墙规则相同的标记标记您的实例

    我详细解释了如何向外界开放港口over here . 替换为您自己的端口号 .

相关问题