Google Cloud Mongo DB:外部 IP 未连接

编程入门 行业动态 更新时间:2024-10-26 12:25:32
本文介绍了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 未连接

本文发布于:2023-11-24 05:19:22,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1624095.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Cloud   Google   Mongo   IP   DB

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!