简体   繁体   English

将我们的 Google App Engine Python API 连接到 Digital Ocean 上的外部 MySQL 数据库

[英]Connect our Google App Engine Python API to an external MySQL database on Digital Ocean

There are already many questions about how to connect to an external MySQL database but they all focus on how to open a remote connection, which is simply fixed by enabling billing.关于如何连接外部 MySQL 数据库的问题已经有很多,但都集中在如何打开远程连接上,通过启用计费即可解决。

However none if these questions address how to open an exception in your MySQL database so that the GCP App engine can connect to it.但是,如果这些问题解决了如何在 MySQL 数据库中打开异常以便 GCP App 引擎可以连接到它,则没有。 Normally a static IP would do, except it seems static IPs are for Compute Instances VM.通常一个 static IP 会做,除了似乎 static IPs 用于计算实例 VM。

It seems like the previous solution was using "Google Secure Data Connector", but it's been decommissioned.以前的解决方案似乎使用“Google 安全数据连接器”,但已停用。

I found something else on Google Cloud documentation that says:我在Google Cloud 文档上发现了其他内容:

Your App Engine app connects over the Internet using that external service's public IP address.您的 App Engine 应用程序使用该外部服务的公共 IP 地址通过 Internet 连接。

However there is no further information and I have no idea if that address is static or ephemeral, but this documentation page seems to say the address will never be static and can not be assigned a static IP: However there is no further information and I have no idea if that address is static or ephemeral, but this documentation page seems to say the address will never be static and can not be assigned a static IP:

App Engine does not currently provide a way to map static IP addresses to an application. App Engine 目前不提供将 map static IP 地址发送到应用程序的方法。

Has anyone ever succeeded?有没有人成功过? How did you set your exception on the external, non-GCP MySQL server?您如何在外部非 GCP MySQL 服务器上设置例外?

AppEngine can connect to internet but with a pool of IP address. AppEngine 可以连接到互联网,但有一个 IP 地址池。 You can't define one and use always the same.您不能定义一个并始终使用相同的。 If your Database has to authorize only one IP it's not yet supported.如果您的数据库必须仅授权一个 IP,则尚不支持。

However, you could cheat by plugging a serverless VPC Connector to your AppEngine and using a VM as proxy but the solution is ugly and I don't guaranty good response time, which is critical for a database...但是,您可以通过将无服务器 VPC 连接器插入 AppEngine 并使用 VM 作为代理来作弊,但解决方案很丑陋,而且我不能保证良好的响应时间,这对于数据库来说至关重要......

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

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