Google Cloud Mongo DB:外部 IP 未连接 [英] Google Cloud Mongo DB: External IP not connecting

查看:22
本文介绍了Google Cloud Mongo DB:外部 IP 未连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have created a ready to go MongoDB server on Google Cloud using the default parameters. Everything is working fine between them (there is communication and I can add DBs and collections). However, I can't connect to MongoDB on any external machine. I created the firewall rules in GCP allowing all the connections ("0.0.0.0./0") on the port 27017.

我正在运行命令:

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

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

I'm getting the same error on both of them. I don't know how to resolve this issue.

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

这是我的防火墙设置.

推荐答案

你有没有

  • 在谷歌云控制台中配置防火墙规则
  • 在您的防火墙规则中提供一个标签
  • 使用与防火墙规则相同的标签标记您的实例

?

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

I explained how to open a port to the outside world in detail over here. Replace with your own port number.

这篇关于Google Cloud Mongo DB:外部 IP 未连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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