【发布时间】:2019-11-13 19:53:21
【问题描述】:
我正在关注此guide 以连接到我的 GCP Cloud Postgresql - 我只有一个私有 IP。当我跑步时
./cloud_sql_proxy -instances=<Instance connection name>=tcp:5432
我得到以下信息(实际引用替换为<Instance connection name>)
2019/04/01 11:46:45 failed to setup file descriptor limits: failed to set rlimit {&{8500 4096}} for max file descriptors: invalid argument
2019/04/01 11:46:45 Listening on 127.0.0.1:5432 for <Instance connection name>
2019/04/01 11:46:45 Ready for new connections
2019/04/01 11:47:28 New connection for <Instance connection name>
2019/04/01 11:49:38 couldn't connect to <Instance connection name>: dial tcp 172.27.160.3:3307: connect: connection timed out
如果我跑了
psql "host=127.0.0.1 sslmode=disable dbname=<db> user=<user> password=<password>"
然后我得到以下内容
psql: FATAL: password authentication failed for user "prodigy"
如果从与我的云 SQL 位于同一网络上的 VM 实例运行相同的 psql 命令,则连接正常。
【问题讨论】:
-
@FahadAbid 不幸不是问题
-
首先,我不知道为什么。但如果它在同一个网络中工作,那么
psql命令中的主机 ip 可能不正确。只是猜测。 -
对不起。当我从 vm 实例调用时,主机 ip 不同。这是一个内部 IP
-
您是否启用了 Cloud SQL API?转到 API 和服务 > 库。在搜索 API 和服务中输入 SQL。选择 Cloud SQL 管理 API。点击启用。
标签: postgresql google-cloud-platform database-connection