【问题标题】:MongoDB to Google Cloud Platform VPC not workingMongoDB 到 Google Cloud Platform VPC 无法正常工作
【发布时间】:2020-04-01 04:28:16
【问题描述】:

我按照this 指南设置了一个 VPC,以允许从我的 GCP 项目到我的 MongoDB Atlas 数据库的流量。

  1. 在 Atlas 上设置 VPC

  1. 将个人计算机和 GCP 列入白名单

  1. 在 GCP 上创建 VPC

  1. 本地测试

作品

  1. 设置虚拟机

  1. SSH 到 VM 并测试登录:
...

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

【问题讨论】:

    标签: mongodb google-cloud-platform vpc mongodb-atlas


    【解决方案1】:

    你必须有 M10 或以上的集群。

    【讨论】:

      【解决方案2】:

      请关注官方文档https://docs.atlas.mongodb.com/security-vpc-peering/index.html

      1. 确保您的 GCP 专用网络的 CIDR 范围不应与 Atlas CIDR 重叠,因为在这种情况下,VPC 对等互连也将不起作用。

      2. 但是,如果情况紧急,您可以将您的公共 IP 在 Atlas 中列入白名单并使其正常工作。

      要使其运行,请添加您的 GCP 控制台的屏幕截图以及 CIDR 范围、安全组、路由表。

      【讨论】:

      • 我也遵循了该指南,但无济于事。 “确保您的 GCP 专用网络的 CIDR 范围不应与 Atlas CIDR 重叠,因为在这种情况下,VPC 对等互连也将不起作用。”您是什么意思? Atlas CIDR是192.168.0.0/16,不知道怎么查看GCP CIDR
      猜你喜欢
      • 1970-01-01
      • 2019-08-30
      • 2018-03-10
      • 1970-01-01
      • 2023-03-29
      • 2020-11-01
      • 1970-01-01
      • 2017-04-22
      • 1970-01-01
      相关资源
      最近更新 更多