【问题标题】:'Connection timed out' when connecting on heroku database using 'pg:psql' command使用“pg:psql”命令连接 heroku 数据库时“连接超时”
【发布时间】:2019-03-07 08:12:28
【问题描述】:

我正在尝试连接到我在 heroku 上的数据库,我将在我的应用程序中使用该数据库。我在 Windows 上使用命令行或 Git Bash。

我在 Heroku 上创建了名为 postgresql-rectangular-87454 的数据库并安装了 Postgres,没有任何错误。

输入 heroku addons 我确定,数据库已设置:

$ heroku addons

Add-on                                            Plan       Price  State
────────────────────────────────────────────────  ─────────  ─────  ───────
heroku-postgresql (postgresql-rectangular-87454)  hobby-dev  free   created
 └─ as DATABASE

但是当我尝试通过heroku pg:psqlheroku pg:psql postgresql-rectangular-87454 --app salty-shelf-36209 连接它时,我收到此错误:

$ heroku pg:psql
--> Connecting to postgresql-rectangular-87454
psql: could not connect to server: Connection timed out (0x0000274C/10060)
        Is the server running on host "ec2-54-225-97-112.compute-1.amazonaws.com" (54.225.97.112) and accepting
        TCP/IP connections on port 5432?

任何建议将不胜感激。谢谢!

【问题讨论】:

    标签: node.js postgresql heroku psql


    【解决方案1】:

    在不了解更多信息的情况下,我的第一个猜测是网络规则——本地防火墙阻止了连接。 pg:psql 命令只是从您的应用程序配置中获取DATABASE_URL 并将连接字符串传递给您本地的psql 命令以创建连接。如果您位于公司防火墙后面,则可能需要与您的 IT 部门讨论建立出站连接。

    【讨论】:

      猜你喜欢
      • 2022-01-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-07-02
      • 1970-01-01
      • 1970-01-01
      • 2014-05-15
      • 1970-01-01
      相关资源
      最近更新 更多