postgresql - HEROKU POSTGRES 错误 : Connection refused Is the server running on host "..compute-1.amazonaws.com..." and accepting TCP/IP connections on port 5432?

标签 postgresql heroku tcp psql

几周来我一直在努力找出问题所在,但我似乎无法解决这个问题。

我正在开发一个网络应用程序,我已经使用 Heroku 部署到生产环境。我正在为我的数据库使用 Heroku Postgres,我想从我的本地计算机 psql 到该托管数据库以对其进行更改。我在 Mac OS X 和 Linux Mint 上都试过了。

但是,无论我尝试什么,我都会不断收到以下错误:

---> Connecting to HEROKU_POSTGRESQL_ORANGE_URL (DATABASE_URL)
psql: could not connect to server: Connection refused
    Is the server running on host "ec2-***-**-***-**.compute-1.amazonaws.com" (***.**.***.**) and accepting
    TCP/IP connections on port 5432?

我开始考虑我可能必须通过 SSH 连接到 Amazon EC2 实例并更改 Postgres 配置?这可能吗?

最佳答案

您不能直接连接到运行 Heroku Postgres 实例的 EC2 实例;它由 Heroku 管理,不允许普通用户连接到它。

如果您的应用程序在 Heroku 中运行良好,并且您正在运行 heroku pg:psql 以尝试连接到数据库,那么很可能是您的本地网络出现了一些问题,阻止了你无法连接到 Postgres 数据库,就像防火墙阻止出站连接一样。 Heroku Postgres 数据库向公众开放,对 IP 范围没有任何限制。

关于postgresql - HEROKU POSTGRES 错误 : Connection refused Is the server running on host "..compute-1.amazonaws.com..." and accepting TCP/IP connections on port 5432?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31578353/

相关文章:

sql - 我应该如何将文本添加到我的列的选择语句中

java - 代码部分我不明白

heroku - 无法安装therubyracer,报错

swift - Stripe 后端示例 : Build fail

c - 通过c中的套接字传递wav文件样本

ruby-on-rails - Heroku Rails PostgreSQL 安装错误

python - 如何向 Postgresql 表添加新列(Python 列表)?

postgresql - 数据库:migrate fails on Heroku due NAMEDATALEN

java - TCP 连接 Socket.getInputStream()

iphone - Objective-C 输出流刷新问题?