PostgreSQL server not listening: tried everything and failed

When I try to connect to PostgreSQL from a remote Windows server using pgAdmin 1.16.1, I get the terrible message "Server is not listening": "Cannot connect to server: connection timed out (0x0000274C / 10060) Is the server running on the host" xxx.xx. xxx.xx "and accepts TCP / IP connections on port 5432.

I am running PostgreSQL 9.3 on CentOS 6.4. Here is what I have tried so far:

  • I can access the database locally using psql --username = postgres. There is a database, it works, and I can query it
  • In postgresql.conf I installed

    listen_addresses = '*'
    port = 5432 
    
  • In pg_hba.conf, I have a server that I am trying to access the database specified as:

    host    all             all             xxx.xx.xxx.0/24         md5
    
  • SELinux is off ( getenforcereceiving a response Disabled)
  • Just in case, I added port 5432 to IPTables

    iptables -A INPUT -p tcp -m tcp --dport 5432 -j ACCEPT
    
  • I went to postgresql with psql and set the password (although I'm sure it is already installed correctly)

    ALTER USER postgres WITH PASSWORD '*************';
    
  • Input netstat -angives these links to port 5432 (not sure if they are relevant):

    Proto Recv-Q Send-Q Local Address               Foreign Address             State      
    tcp        0      0 0.0.0.0:5432                0.0.0.0:*                   LISTEN      
    
    tcp        0      0 :::5432                     :::*                        LISTEN      
    
    Active UNIX domain sockets (servers and established)
    Proto RefCnt Flags       Type       State         I-Node Path
    unix  2      [ ACC ]     STREAM     LISTENING     677454 /tmp/.s.PGSQL.5432
    
  • I can ping from a remote server to a database server

  • I have no problem connecting to another server running PostgreSQL 9.1 on Ubuntu from the same remote server using the same pgAdmin installation

I'm at a dead end. Does anyone know what else could be wrong? And yes, I did not forget to restart the server after changing the configuration files. I believe that I read all the other posts on this subject.

+4
source share
1

, OUTPUT?

iptables -A INPUT -p tcp -s 0/0 --sport 1024:65535 -d xx.xx.xx.xx  --dport 5432 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -p tcp -s xx.xx.xx.xx --sport 5432 -d 0/0 --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT

xx.xx.xx.xx - your server IP
+2

All Articles