psql --host 10.78.0.3 -U gcp-network-issue-demo-staging-db-user gcp-network-issue-demo-staging-database
不会提示输入密码,只需坐在那里。我假设psql连接尝试通过了错误的网络接口或某种东西(这可能只是我对网络内容的无知)-如何使它工作?我想念什么?
PS:这基本上与从具有私有IP和公共IP的虚拟机连接到私有IP上的Google Cloud SQL实例失败是相同的问题,但是那里的评论者似乎想要一个与Terraform相关的问题以及一个与连接问题相关的问题。
一些截图:
I don't understand why the private IP of the DB instance (10.78.0.3
) is not an IP from the range of the private network (10.2.0.0
-10.2.0.24
, right?)..? Is that my problem?
To answer your question:
I don't understand why the private IP of the DB instance (10.78.0.3) is not an IP from the range of the private network (10.2.0.0-10.2.0.24, right?)..?
The Cloud SQL instance is assigned an IP address from the allocated range. When you setup a private services access a VPC peering is created between your VPC gcp-network-issue-demo-staging-network and the service producer VPC network that uses the allocated range 10.78.0.0/16
另外,查看您的VM网络配置,我发现VM在两个不同的VPC(默认和gcp-network-issue-demo-staging-network)中有两个Nics 。在您的情况下,您只能使用一个Nic。
下一步,请确保您的VM仅使用您用于创建专用连接的VPC网络。完成此操作后,您应该可以使用以下命令连接到Cloud SQL实例IP:
telnet 10.78.0.3 3306
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句