简体   繁体   English

无法连接 GCP 云 SQL 私有实例

[英]Unable to connect to GCP cloud SQL private instance

We have create private cloud instance but I am unable to connect to it using MYSQL workbench, php or a ODBC client.我们已经创建了私有云实例,但我无法使用 MYSQL 工作台、php 或 ODBC 客户端连接到它。

From the same compute instance I can connect using mysql -h IP -u user -p *****.从同一个计算实例,我可以使用 mysql -h IP -u user -p ***** 进行连接。 With GCP services I usually find gotcha in some document and I have tried digging everything possible.使用 GCP 服务时,我通常会在一些文档中发现问题,并且我已经尝试挖掘所有可能的东西。 Here below error from a ODBC client:下面是来自 ODBC 客户端的错误:

BIP2393E: Database error: ODBC return code '-1' from data source ''DEVA'' using ODBC driver manager ''/opt/iib-10.0.0.20/ie02/lib/libodbcinterface.so''. BIP2393E:数据库错误:使用 ODBC 驱动程序管理器“/opt/iib-10.0.0.20/ie02/lib/libodbcinterface”从数据源“DEVA”返回代码“-1”ODBC。 The integration node received an error when processing a database operation.处理数据库操作时,集成节点收到错误。 The ODBC return code was '-1'. ODBC 返回码为“-1”。 See the following messages for information obtained from the database about this error.有关从数据库获得的有关此错误的信息,请参阅以下消息。 Use the following messages to determine the cause of the error.使用以下消息确定错误的原因。 Typical problems are an incorrect data source, or table names.典型的问题是不正确的数据源或表名。 Correct either the database or the integration node configuration.更正数据库或集成节点配置。 Use the mqsicvp command to test connectivity to this database.使用 mqsicvp 命令测试与此数据库的连接。 BIP2322E: Database error: SQL State ''HY000''; BIP2322E:数据库错误:SQL State ''HY000''; Native Error Code '2003';本机错误代码“2003”; Error Text ''[unixODBC][MySQL][ODBC 5.3(a) Driver]Can't connect to MySQL server on '1x.1x.1x.1x' (110)''.错误文本“[unixODBC][MySQL][ODBC 5.3(a) 驱动程序]无法连接到“1x.1x.1x.1x”(110) 上的 MySQL 服务器。 The error has the following diagnostic information: SQL State ''HY000'' SQL Native Error Code '2003' SQL Error Text ''[unixODBC][MySQL][ODBC 5.3(a) Driver]Can't connect to MySQL server on 'xxxx' (110)'' This message may be accompanied by other messages describing the effect on the integration node itself. The error has the following diagnostic information: SQL State ''HY000'' SQL Native Error Code '2003' SQL Error Text ''[unixODBC][MySQL][ODBC 5.3(a) Driver]Can't connect to MySQL server on ' xxxx' (110)'' 此消息可能伴随着描述对集成节点本身的影响的其他消息。 Use the reason identified in this message with the accompanying messages to determine the cause of the error.使用此消息中标识的原因和随附的消息来确定错误的原因。 Use the mqsicvp command to test connectivity to this database.使用 mqsicvp 命令测试与此数据库的连接。

If I try and use a local proxy I get below:如果我尝试使用本地代理,我会得到以下信息:

BIP8299I: User 'user' from security resource name 'BIGDEVA' will be used for the connection to datasource 'DEVA'. BIP8299I: 来自安全资源名称“BIGDEVA”的用户“user”将用于连接到数据源“DEVA”。 BIP8290I: Verification passed for the ODBC environment. BIP8290I:已通过 ODBC 环境的验证。 2020/07/16 20:29:41 New connection for "sql-instance" 2020/07/16 20:31:49 couldn't connect to "sql-instance": dial tcp xxxx:3307: connect: connection timed out BIP2393E: Database error: ODBC return code '-1' from data source ''DEVA'' using ODBC driver manager ''/opt/iib-10.0.0.20/ie02/lib/libodbcinterface.so''. 2020/07/16 20:29:41 “sql-instance”的新连接 2020/07/16 20:31:49 无法连接到“sql-instance”:拨打 tcp xxxx:3307:连接:连接超时BIP2393E:数据库错误:使用 ODBC 驱动程序管理器“/opt/iib-10.0.0.20/ie02/lib/libodbcinterface”从数据源“DEVA”返回代码“-1”ODBC。 The integration node received an error when processing a database operation.处理数据库操作时,集成节点收到错误。 The ODBC return code was '-1'. ODBC 返回码为“-1”。 See the following messages for information obtained from the database about this error.有关从数据库获得的有关此错误的信息,请参阅以下消息。 Use the following messages to determine the cause of the error.使用以下消息确定错误的原因。 Typical problems are an incorrect data source, or table names.典型的问题是不正确的数据源或表名。 Correct either the database or the integration node configuration.更正数据库或集成节点配置。 Use the mqsicvp command to test connectivity to this database.使用 mqsicvp 命令测试与此数据库的连接。 BIP2322E: Database error: SQL State ''08S01''; BIP2322E:数据库错误:SQL State ''08S01''; Native Error Code '2013';本机错误代码“2013”; Error Text ''[unixODBC][MySQL][ODBC 5.3(a) Driver]Lost connection to MySQL server at 'reading initial communication packet', system error: 0''.错误文本 ''[unixODBC][MySQL][ODBC 5.3(a) Driver]Lost connection to MySQL server at 'reading initial communication packet',系统错误:0''。 The error has the following diagnostic information: SQL State ''08S01'' SQL Native Error Code '2013' SQL Error Text ''[unixODBC][MySQL][ODBC 5.3(a) Driver]Lost connection to MySQL server at 'reading initial communication packet', system error: 0'' This message may be accompanied by other messages describing the effect on the integration node itself. The error has the following diagnostic information: SQL State ''08S01'' SQL Native Error Code '2013' SQL Error Text ''[unixODBC][MySQL][ODBC 5.3(a) Driver]Lost connection to MySQL server at 'reading initial通信数据包',系统错误:0'' 此消息可能伴随着描述对集成节点本身的影响的其他消息。 Use the reason identified in this message with the accompanying messages to determine the cause of the error.使用此消息中标识的原因和随附的消息来确定错误的原因。 Use the mqsicvp command to test connectivity to this database.使用 mqsicvp 命令测试与此数据库的连接。

Private cloud instance I meant that the network it sits in has no internet access, I guess it was not needed.私有云实例我的意思是它所在的网络没有互联网接入,我想它是不需要的。 Subnet A holds the client VM and Subnet B holds the DB instance and they have SA account based firewall rules.子网 A 保存客户端 VM,子网 B 保存数据库实例,它们具有基于 SA 帐户的防火墙规则。 Though we found the issue as the firewall was open on service accounts on the VM so using a mysql client was working but apparently GKE POD subnet need it's own firewall rules and it doesn't inherit VM SA account/tag rules whereas a standalone docker container on it's own does.虽然我们发现了问题,因为防火墙在 VM 上的服务帐户上打开,因此使用 mysql 客户端正在工作,但显然 GKE POD 子网需要它自己的防火墙规则,它不继承 VM SA 帐户/标签规则,而独立的 docker 容器靠它自己。

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

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