是否可以通过Google Managed VM连接到Google Cloud SQL? [英] Is it possible to connect to Google Cloud SQL from a Google Managed VM?

查看:93
本文介绍了是否可以通过Google Managed VM连接到Google Cloud SQL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以通过 Google云端SQL ? //cloud.google.com/appengine/docs/managed-vms/rel =nofollow> Google Managed VM ?使用常规的Google App Engine应用程序,我可以通过在Cloud SQL控制台中授权我的项目并使用 unix_socket ='/ cloudsql /'+ _INSTANCE_NAME 进行连接。但是, / cloudsql / 套接字似乎在托管虚拟机上不可用。我必须将我的Managed VM应用程序的IP列入白名单吗?如果是这样,我该如何找到白名单的IP地址?

解决方案 / cloudsql / 套接字仅在常规App Engine中可用。受管VM是常规VM,因此与Cloud SQL的连接需要使用该Cloud SQL实例的外部IP。外部IP需要列入白名单。外部IP显示在开发人员控制台中,也可以通过gcloud CLI工具检索。



避免将GCE VM的IP列入白名单的两个选项是: / p>


  1. 切换为仅使用SSL连接进行IP连接,并将白名单0.0.0.0/0。

  2. 漏斗例如,通过运行TCP代理(HAProxy)的VM的所有到Cloud SQL的流量。

我们知道这些是非常满意的解决方案: - (

Is it possible to connect to Google Cloud SQL from a Google Managed VM? With regular Google App Engine applications, I can connect by authorizing my project in the Cloud SQL console and using unix_socket='/cloudsql/' + _INSTANCE_NAME. However, the /cloudsql/ socket doesn't seem to be available on Managed VMs. Do I have to whitelist the IP of my Managed VM application? If so, how do I find the IP address to whitelist?

解决方案

The /cloudsql/ sockets are only available in regular App Engine. Managed VMs are regular VMs so connection to Cloud SQL needs to use the external IP of that Cloud SQL instances. The external IP needs to be whitelisted. The external IP is showed in the Developers Console and can also be retrieved via gcloud CLI tool.

Two options to avoid having to whitelist the IP of the GCE VMs are:

  1. Switch to use only SSL connections for IP connectivity and whitelist 0.0.0.0/0.
  2. Funnel all the traffic to Cloud SQL via a VM that runs a TCP proxy (HAProxy) for example.

We are aware that none of these are very satisfying solutions. :-(

这篇关于是否可以通过Google Managed VM连接到Google Cloud SQL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆