现在我只是想制作 heroku pg:psql
命令工作,但我的最终目的是将我的计算机(本地主机)上的数据库复制到带有pg:push
的heroku postgresql数据库命令。
现在,当我只是尝试访问我在 heroku 上创建的数据库时,heroku pg:psql
命令返回:
psql: could not connect to server: No route to host
Is the server running on host "ec*-**-***-***-**.eu-west-1.compute.amazonaws.com" (**.***.***.**) and accepting
TCP/IP connections on port 5432?
postgresql.conf:(这些行没有注释)
listen_address ='*'
port = 5432
ssl = true
和host all all **.***.***.** trust
在pg_hba.conf
我还尝试向 iptables 添加规则,以便从 heroku 提供的主机 IP 地址访问数据库。
我使用的是 Debian 计算机,我该如何解决这个问题?
最佳答案
psql: could not connect to server: No route to host
这意味着您的 PostgreSQL 服务器未启动或正在不同的端口上启动。
您可以尝试的解决方案:
- 通过命令
ps -ef | grep Postgres
检查PostgreSQL服务. - 通过命令
netstat -tupln | grep Postgres
查看PostgreSQL监听的端口. - 确保您的服务器启用 UDP 端口,因为 PostgreSQL 需要 UDP 端口环回来提供统计收集器服务。
- 检查启动日志或位于 pg_log 的数据库日志以了解问题。
关于postgresql - Heroku Postgresql pg :psql No Route to host,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44910684/