Thread: FW: Can not always connect to postmaster. Sometimes get "Connection refused".
FW: Can not always connect to postmaster. Sometimes get "Connection refused".
From
"Hamedany, Allen"
Date:
=20 Hi, =20 We're running postgres7.3 on RedHat7.3. The Postgres at boot time is started up from a java (1.2) class that runs the following commands in order: =20 /usr/local/pgsql/bin/pg_ctl -w start -D /var/lib/pgsql -l /var/log/pgsqld.log -o -i /usr/local/pgsql/bin/createdb management =2E =2E =2E =20 As you can tell the postmaster starts up with "-i" option here.=20 =20 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ In pg_hba.conf we have: local all all trust host all all 127.0.0.1 255.255.255.255 trust host all all 192.168.0.0 255.255.0.0 trust =20 The host IP address is 192.168.55.5 which is in the right subnet. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ In postgresql.conf:=20 =20 # # Connection Parameters # tcpip_socket =3D true #ssl =3D false =20 max_connections =3D 64 #superuser_reserved_connections =3D 2 =20 #port =3D 5432=20 #hostname_lookup =3D false #show_source_port =3D false =20 #unix_socket_directory =3D '' #unix_socket_group =3D '' #unix_socket_permissions =3D 0777 # octal =20 As you can see tcpip_socket =3D true ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ =20 =20 Sometimes, after Postgres starts up, when the database clients try to access the db from the localhost, we get the following error: =20 com.solarmetric.kodo.Runtime - com.solarmetric.kodo.runtime.FatalDataStoreException: Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.=20 =20 Any ideas what's causing postmaster NOT to accept connections some of the time? =20 This problem almost always goes away upon rebooting the machine. =20 Any help is much appreciated. =20 Thanks, -Allen =20 ***************************************************************************= *********** This email message and any files transmitted with it contain confidential i= nformation intended only for the person(s) to whom this email message is ad= dressed. If you have received this email message in error, please notify th= e sender immediately by telephone or email and destroy the original message= without making a copy. Thank you. ***************************************************************************= ***********
Re: FW: Can not always connect to postmaster. Sometimes get "Connection refused".
From
Tom Lane
Date:
"Hamedany, Allen" <Allen.Hamedany@revivio.com> writes: > Sometimes, after Postgres starts up, when the database clients try to > access the db from the localhost, we get the following error: > com.solarmetric.kodo.Runtime - > com.solarmetric.kodo.runtime.FatalDataStoreException: Connection > refused. Check that the hostname and port are correct and that the > postmaster is accepting TCP/IP connections. > Any ideas what's causing postmaster NOT to accept connections some of > the time? Nope, can't tell much from that message. You should look in the postmaster's log to see if it shows any messages at the time that a connection fails like this. (If you are sending the postmaster's stderr to /dev/null, now would be a good time to stop doing that...) If the postmaster doesn't log anything at all when this happens, my conclusion would be that the connection is being rejected at the kernel level (but why would that happen only intermittently??) or that you have a network-level problem. "Connection refused" sounds a bit like a kernel-level issue, FWIW. Another thing to ask about is whether there are any firewall machines between your clients and your database. regards, tom lane