我无法从我的机器连接到运行Postgres的服务器。 我想我已经正确configuration了一切。 服务器上没有防火墙。
我在Ubuntu 12.04 LTS上运行Postgres 9.1.9
这是从/etc/postgresql/9.1/main/pg_hba.conf
local all postgres peer # TYPE DATABASE USER ADDRESS METHOD local all all peer host all all 0.0.0.0/0 md5 host all all ::1/128 md5
我在/etc/postgresql/9.1/main/postgresql.conf中有listen_addresses = '*'
我已经停止并多次启动服务。
netstat -tulnp :
Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:27017 0.0.0.0:* LISTEN 19312/mongod tcp 0 0 0.0.0.0:28017 0.0.0.0:* LISTEN 19312/mongod tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 978/sshd tcp 0 0 0.0.0.0:5432 0.0.0.0:* LISTEN 30239/postgres tcp6 0 0 :::22 :::* LISTEN 978/sshd tcp6 0 0 :::5432 :::* LISTEN 30239/postgres
我的iptable是空的。
当我尝试连接到服务器
psql -U postgres -h <MY_IP>
我得到:
psql: could not connect to server: Operation timed out Is the server running on host "<MY_IP>" and accepting TCP/IP connections on port 5432?
任何帮助? 谢谢
端口5432上的tcpdump:
16:33:10.548507 7c:c3:a1:a2:d9:27 (oui Unknown) > 00:00:5e:00:01:01 (oui Unknown), ethertype IPv4 (0x0800), length 78: <MY_MAC> > <MY_SERVER>.postgresql: Flags [S], seq 95915852, win 65535, options [mss 1460,nop,wscale 4,nop,nop,TS val 1189142453 ecr 0,sackOK,eol], length 0
我可以连接到服务器上的postgres( psql -U postgres -h localhost ),但是我无法从我的机器上telnet到5432上。
请记住,运行客户端的机器人可能也会设置阻塞连接的入站或出站部分的iptables规则。
看起来有阻止你的networkingstream量的防火墙。 您的消息中没有关于networking(客户端和postgres服务器)的信息,但是看起来有一些阻止客户端和服务器之间stream量的防火墙规则。
你使用ipv4或ipv6。
因为你的tcpdump示例显示ipv6连接,并且你没有在pg_hba.conf上启用ipv6连接
:: 1/128 ——–> loopback