【发布时间】:2020-11-29 18:18:58
【问题描述】:
我的云运行中有一个容器,它期望接收DATABASE_URL 变量。
我想连接到我现有的 GCP postgres db,但我无法让它工作。
我已经在我的数据库实例上定义了一个私有 IP 并尝试通过这个 url 字符串进行连接
postgres://<db-user-name>:<my-password>@<my-ip>/<my-db-name>
在日志中我可以看到它只是库存:
level=info msg="Connecting with postgres://<username>:<password>@<db-ip>/<dbname>"
几分钟,然后它说:
level=info msg="Unable to connect to database" error="Could not Connect to SQL: dial tcp <ip>:5432: connect: connection timed out"
任何帮助将不胜感激。
【问题讨论】:
-
你遇到了什么错误?
-
分享你正在使用的连接网址
-
DATABASE_URL=postgres://{user}:{password}@{hostname}:{port}/{database-name}
-
它是相同的结构.. 没有端口,但我也尝试过它没有工作的端口
-
请分享 postgresql.conf 文件
标签: postgresql docker gcloud