首页 > 解决方案 > 无法与远程 heroku 数据库建立 psql 会话

问题描述

我有一个远程 heroku 数据库(“爱好”层)并想建立一个远程 psql 连接,但是当我输入:

heroku pg:psql

我收到以下错误:

psql: could not connect to server: Operation timed out
    Is the server running on host "ec2-54-163-230-199.compute-1.amazonaws.com" (54.163.230.199) and accepting
    TCP/IP connections on port 5432?

我已经编辑了 postgresql.conf 这样

listen_addresses = '*'

并添加了一行:

host all all 0.0.0.0/0 md5

到 pg_hba.conf 因为我认为问题可能是我的 postgres 配置只接受到 localhost 的连接,但是重新启动 Postgres 我仍然遇到同样的错误。

有人对可能出现的问题有任何建议吗?如果我的防火墙被阻止,有人会对如何改变它有任何建议吗?提前致谢。

标签: postgresqlherokuheroku-postgresheroku-cli

解决方案


必须有网络限制或防火墙设置,因为它应该可以在不更改 conf 文件的情况下工作。


推荐阅读