当我将http_proxy、https_proxy变量设置为正确的值时,我已经能够在企业防火墙后面使用google。它还看起来像服务帐户的inital连接与那些代理vars集一起工作。但是,当我尝试使用mysql客户端连接到运行代理的机器时,到google实例的连接将失败。
下面是我对代理BTW的命令(验证代理cmd/setup在不在公司防火墙后面的系统上工作):
cloud_sql_proxy -instances=api-project-1054727403053:us-east1:mysql-google-v1=tcp:3306 -credential_file=c:\tools\myeditor.json
2017/09/14 09:39:29 using credential file for authentication; email=myeditor@api
-project-1054727403053.iam.gserviceaccount.com
2017/09/14 09:39:29 Listening on 127.0.0.1:3306 for api-project-1054727403053:us
-east1:mysql-google-v1
2017/09/14 09:39:29 Ready for new connections
2017/09/14 09:39:34 New connection for "api-project-1054727403053:us-east1:mysql
-google-v1"
2017/09/14 09:39:57 couldn't connect to "api-project-1054727403053:us-east1:mysq
l-google-v1": dial tcp 35.190.176.161:3307: connectex: A connection attempt fail
ed because the connected party did not properly respond after a period of time,
or established connection failed because connected host has failed to respond.
2017/09/14 09:39:58 New connection for "api-project-1054727403053:us-east1:mysql
-google-v1"
2017/09/14 09:40:19 Throttling refreshCfg(api-project-1054727403053:us-east1:mys
ql-google-v1): it was only called 43.386s ago
2017/09/14 09:40:40 couldn't connect to "api-project-1054727403053:us-east1:mysq
l-google-v1": dial tcp 35.190.176.161:3307: connectex: A connection attempt fail
ed because the connected party did not properly respond after a period of time,
or established connection failed because connected host has failed to respond.
2017/09/14 09:40:41 New connection for "api-project-1054727403053:us-east1:mysql
-google-v1"
2017/09/14 09:41:23 couldn't connect to "api-project-1054727403053:us-east1:mysq
l-google-v1": dial tcp 35.190.176.161:3307: connectex: A connection attempt fail
ed because the connected party did not properly respond after a period of time,
or established connection failed because connected host has failed to respond.这个错误看起来..。拨号tcp 35.190.176.161:3307: connectex:连接尝试失败是因为连接方在一段时间后没有正确响应
同样,我已经验证了上面的代理设置在一个不在公司防火墙后面的系统上工作,所以我想知道是否存在将云代理配置为使用http_ proxy /https_proxy来建立连接和通信?
谢谢
发布于 2017-09-25 01:50:03
MySQL有自己的协议,完全独立于HTTP,通常在端口3306上。当Cloud代理使用HTTP进行初始auth设置时,实际的SQL连接将该协议封装在端口3307的TLS中。不幸的是,没有办法通过HTTP运行MySQL协议。相反,您将需要一个例外的企业防火墙。
如果您只需要在命令行上访问Cloud,我建议您从Cloud执行此操作,如https://cloud.google.com/sql/docs/mysql/connect-admin-ip#cloud-shell中所述。
如果您想要构建一个更复杂的应用程序,从防火墙后面访问Cloud,您可以构建一个GAE应用程序来公开HTTP。然后,您可以通过代理使用该API,GAE应用程序可以连接到Cloud。
https://stackoverflow.com/questions/46221131
复制相似问题