2016-12-22 102 views
0

我按照我在网上找到的所有建议,但我似乎无法得到这个工作。无法远程连接到postgresql

背景:

我已经安装PostgreSQL的9.6运行RHEL 6.8的服务器上。我正尝试从运行Linux Mint 17.3的客户端远程连接到此服务器的Postgresql服务。

我已经试过:

1)在postgresql.conf中,我将这两行:

listen_addresses = '*' 
port = 5432 

2)pg_hba.conf中,我加入这一行:

host all all 0.0.0.0/0 md5 

3)重启动PostgreSQL服务器算账:

service postgresql-9.6 restart 

4)添加规则的防火墙允许以防万一端口5432连接:

iptables -A INPUT -s 0/0 -p tcp --dport 5432 -j ACCEPT 

5)然netstat -tulpn | grep 5432和得到这个输出:

tcp 0 0 0.0.0.0:5432 0.0.0.0:* LISTEN 2625/postmaster 
tcp 0 0 ::::5432  :::*  LISTEN 2625/postmaster 

这里是我跑的命令从客户端连接到我的服务器:

psql -h my_host_name -d my_database_name -U postgres 

而且我得到了以下输出:

psql: could not connect to server: Connection timed out 
    Is the server running on host "my_host_name" (my_ip_address) and accepting 
    TCP/IP connections on port 5432? 

问题

还有什么能做些什么来进一步解决这个问题?

+0

''psql -h 127.0.0.1 ...'在RHEL中工作吗? –

回答

0

原来我们网络上还有另一个防火墙,我没有考虑到这个问题。对于处理这个问题的其他人,确保你是绝对是确定你没有处理防火墙。