[英]Google Cloud - Cant connect to MySQL cloud sql instance from GKE using internal IP
I am trying to migrate to use private IP:s for all our Cloud SQL instances.我正在尝试迁移以将私有 IP:s 用于我们所有的 Cloud SQL 实例。 I have gotten it working for postgres, and am now trying to get access for our wordpress instances using MySQL.
我已经让它为 postgres 工作了,现在我正在尝试使用 MySQL 访问我们的 wordpress 实例。
The problem is I cant get the connection working from the running pods in our GKE cluster.问题是我无法通过 GKE 集群中正在运行的 pod 建立连接。
root@******:/var/www/app# mysql --host=10.**.**.* -u *_se -p
Enter password:
ERROR 2003 (HY000): Can't connect to MySQL server on '10.*.*.*' (110 "Connection timed out")
I have activated the private IP on the Cloud SQL instance, and added a private service connection to the VPC-network that is the same network that our cluster uses, but still cant connect in the same way as I did with postgres.我已经激活了 Cloud SQL 实例上的私有 IP,并在 VPC 网络中添加了一个私有服务连接,该网络与我们的集群使用的网络相同,但仍然无法像使用 postgres 那样连接。
Does anyone know anything I could try to get this working?有谁知道我可以尝试让这个工作吗?
Note : If you are using shared VPC networks, you cannot assign a private IP address in a shared VPC network to an existing Cloud SQL instance.
注意:如果您使用共享 VPC 网络,则无法将共享 VPC 网络中的私有 IP 地址分配给现有 Cloud SQL 实例。 Also, VPC Network Peering uses private services access.
此外,VPC 网络对等互连使用私有服务访问。 However, you do not create the VPC Network Peering explicitly, because the peering is internal to Google Cloud.
但是,您没有明确创建 VPC 网络对等互连,因为对等互连是 GCP 内部的。
I would suggest you check the firewall setting and check if your MySQL server is listening on default port 3306. Also try to connect MySQL server on IP for which MySQL server is bound in 'my.cnf'.我建议您检查防火墙设置并检查您的 MySQL 服务器是否正在侦听默认端口 3306。同时尝试在 MySQL 服务器绑定在“my.cnf”中的 IP 上连接 MySQL 服务器。 If it not so, run the following command to bind address if you are using Ubuntu:
如果不是这样,如果您使用的是 Ubuntu,请运行以下命令来绑定地址:
1. Run the command vim /etc/mysql/my.cnf or vim /etc/mysql/mysqld.conf/mysqld.cnf
2. Comment bind-address = <Server IP> using the # symbol
3. Restart your MYSQL server once.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.