host_ip
-U db_username
-d db_name
发生以下错误:
psql: could not connect to server: Connection refused
Is the server running on host "<host_ip>" and accepting
TCP/IP connections on port 5432?以下是需要注意的几点:
1. Postgres安装版本为9.4。 2. 主机操作系统:Ubuntu 15.04。 3. 客户端操作系统:Centos 7。
我已经尝试了以下方法,但问题仍未解决:
1. 编辑
pg_hba.conf
文件以包括:host all all 0.0.0.0/0 md5
2. 编辑'postgresql.conf'并将监听参数更改为: listen_addresses='*'
- 重新启动了Postgres服务。
- 在主机和客户端上禁用了防火墙和iptables。
- 我通过在本地运行psql命令进行了检查,它可以正常工作。
- 我尝试了此question中给出的第二个解决方案。运行
nmap
命令后,我得到了以下输出:
Starting Nmap 6.47 ( http://nmap.org ) at 2015-09-07 18:08 IST Nmap scan report for 10.17.250.250 Host is up (0.0000040s latency). Not shown: 997 closed ports PORT STATE SERVICE 22/tcp open ssh 25/tcp open smtp 80/tcp open http
我有什么遗漏吗?希望有人能帮忙。
sudo ufw disable
禁用了 iptables,但我仍然收到相同的错误。 - Poonam Anthony