0

我遵循了我在网上找到的所有建议,但我似乎无法让它发挥作用。

背景:

我在运行 RHEL 6.8 的服务器上设置了 Postgresql 9.6。我正在尝试从运行 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?

问题

我还能做些什么来进一步解决此问题?

4

1 回答 1

0

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

于 2016-12-23T14:24:15.690 回答