[英]MongoDB to Google Cloud Platform VPC not working
我按照本指南设置了一个 VPC,以允许从我的 GCP 项目到我的 MongoDB Atlas 数据库的流量。
作品
...
2020-04-01T04:15:59.926+0000 I NETWORK [js] DBClientConnection failed to receive message from shard...mongodb.net.:27017 - HostUnreachable: Connection closed by peer
2020-04-01T04:15:59.927+0000 W NETWORK [js] Unable to reach primary for set shard...
*** It looks like this is a MongoDB Atlas cluster. Please ensure that your IP whitelist allows connections from your network.
2020-04-01T04:15:59.927+0000 E QUERY [js] Error: connect failed to replica set shard.../shard...mongodb.net.:27017,shard...mongodb.net.:27017,shard...mongodb.net.:27017 :
connect@src/mongo/shell/mongo.js:344:17
@(connect):2:6
exception: connect failed
您必须有 M10 或更高版本的集群。
请按照官方文档https://docs.atlas.mongodb.com/security-vpc-peering/index.html
确保 GCP 专用网络的 CIDR 范围不应与 Atlas CIDR 重叠,因为在这种情况下,VPC 对等互连也将不起作用。
但是,如果它很紧急,那么您可以将您的公共 IP 列入 Atlas 中的白名单并使其正常工作。
要使其运行请添加您的 GCP 控制台的屏幕截图以及 CIDR 范围、安全组、路由表。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.