繁体   English   中英

如何将 Google App Engine NodeJS 应用程序连接到 Compute Engine 中的 MongoDB?

[英]How do you connect Google App Engine NodeJS app to MongoDB in Compute Engine?

我有一个用nodeJS编写的 Google App Engine 项目。 该项目需要一个 MongoDB 服务器。 最好在 Compute Engine 中托管。 如何将 App Engine 连接到 Compute Engine,鉴于 App Engine 将始终具有动态 IP,因此无法添加到 Compute Engine 的白名单中?

您的计算引擎在您的 VPC 上运行。 因此,为了保护通信,您必须使用 App Engine 中的计算引擎私有 IP。

但是,App Engine 并不存在于您的 VPC 中,而是存在于由 Google Cloud 管理的无服务器世界中。 为此,您必须使用无服务器 VPC 连接器来连接这两个世界。

完成后,只需将 Compute Engine 的私有 IP 与 MongoDB 一起使用即可访问它。


但是,为自己托管一个 MongoDB 服务器并不是一个好主意。 您可以使用 Google Cloud 上的MongoDB Atlas解决方案获得有用且强大的无服务器托管。 我强烈建议您看看它以提高安全性、高可用性并降低您的运营成本

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM