Thread: can't connect to postmaster from other machine

can't connect to postmaster from other machine

From
FOlkeN
Date:
Hi everyone,

I'm new to PostgreSQL, i'm using version 7.1.3 on Mac OS X.1.2. It works
perfectly when I connect through localhost but when I try to connect from
other machine on the network i can't. Anyway, the computers can ping each
other, and other applications on the network work well.

I'm running postmaster with this command line:

          postgres$ postmaster -i -D /usr/local/pgsql/data

And psql from the other machine with this:

         postgres$ psql -h 192.168.0.21

after a lot of time (2 or 3 minutes) it shows this message:

psql: PQconnectPoll() -- connect() failed: Operation timed out
         Is the postmaster running (with -i) at '192.168.0.21'
         and accepting connections on TCP/IP port 5432?

Thanks


Re: can't connect to postmaster from other machine

From
Einar Karttunen
Date:
On 07.02.02 12:52 +0000(+0000), FOlkeN wrote:
> Hi everyone,
>
> I'm new to PostgreSQL, i'm using version 7.1.3 on Mac OS X.1.2. It works
> perfectly when I connect through localhost but when I try to connect from
> other machine on the network i can't. Anyway, the computers can ping each
> other, and other applications on the network work well.
>
> I'm running postmaster with this command line:
>
>          postgres$ postmaster -i -D /usr/local/pgsql/data
>
> And psql from the other machine with this:
>
>         postgres$ psql -h 192.168.0.21
>
> after a lot of time (2 or 3 minutes) it shows this message:
>
> psql: PQconnectPoll() -- connect() failed: Operation timed out
>         Is the postmaster running (with -i) at '192.168.0.21'
>         and accepting connections on TCP/IP port 5432?

There is a file called pg_hba.conf which specifies who is
allowed to connect from which location. Set it to allow
connections from the hosts your using postgres from.

- Einar Karttunen



Re: can't connect to postmaster from other machine

From
Walter Hop
Date:
[in reply to folken@mac.com, 07/02/2002]

> psql: PQconnectPoll() -- connect() failed: Operation timed out
>          Is the postmaster running (with -i) at '192.168.0.21'
>          and accepting connections on TCP/IP port 5432?

There are two ways to talk to postmaster:
a) via a UNIX socket (on the local machine)
b) via TCP-IP (local or via the network)

By default, postmaster does not listen on a TCP port. If the network is
okay and you can ping 192.168.0.21 successfully, chances are that
postmaster does not have a TCP port open, so it is not listening to
queries from the network.

Edit postgresql.conf on your database server machine, scroll down to where
it says "Connection Parameters". Is the value "tcpip_socket" set to true?
If it's set to false, change that and restart postmaster.

If it IS set to true, there is something else going on. If so, please
reply!

good luck,
walter

--
 Walter Hop <walter@binity.com>
 Updated contact information: http://www.binity.com/~walter/


Re: can't connect to postmaster from other machine

From
Walter Hop
Date:
[in reply to ekarttun@cs.helsinki.fi, 07/02/2002]

>> psql: PQconnectPoll() -- connect() failed: Operation timed out
>>         Is the postmaster running (with -i) at '192.168.0.21'
>>         and accepting connections on TCP/IP port 5432?

Hmmmm... at second thought, I think the "Operation timed out" might be due
to firewall rules instead (probably on the server box)?

A missing entry in pg_hba.conf gives this error:

  psql: No pg_hba.conf entry for host 1.2.3.4, user walter, database walter

And a postmaster that doesn't listen to the TCP port gives:

  psql: connectDBStart() -- connect() failed: Connection refused

This on the other hand is a "Operation timed out". FOlkeN, do you perhaps
have firewall rules in place on the server box? What happens if you use
psql from the server box to itself via TCP, using ``psql -h 127.0.0.1''?

--
 Walter Hop <walter@binity.com>
 Updated contact information: http://www.binity.com/~walter/


Re: can't connect to postmaster from other machine

From
FOlkeN
Date:
I've looked at postgresql.conf and "tcpip_socket" is set to true...

I get the same message when I try to connect with:    psql -h 127.0.0.1


El jueves, 7 febrero, 2002, a las 01:58 , Walter Hop escribió:"

> [in reply to ekarttun@cs.helsinki.fi, 07/02/2002]
>
>>> psql: PQconnectPoll() -- connect() failed: Operation timed out
>>>         Is the postmaster running (with -i) at '192.168.0.21'
>>>         and accepting connections on TCP/IP port 5432?
>
> Hmmmm... at second thought, I think the "Operation timed out" might be due
> to firewall rules instead (probably on the server box)?
>
> A missing entry in pg_hba.conf gives this error:
>
>   psql: No pg_hba.conf entry for host 1.2.3.4, user walter, database
> walter
>
> And a postmaster that doesn't listen to the TCP port gives:
>
>   psql: connectDBStart() -- connect() failed: Connection refused
>
> This on the other hand is a "Operation timed out". FOlkeN, do you perhaps
> have firewall rules in place on the server box? What happens if you use
> psql from the server box to itself via TCP, using ``psql -h 127.0.0.1''?
>
> --
>  Walter Hop <walter@binity.com>
>  Updated contact information: http://www.binity.com/~walter/


Re: can't connect to postmaster from other machine

From
Tom Lane
Date:
Walter Hop <walter@binity.com> writes:
> Hmmmm... at second thought, I think the "Operation timed out" might be due
> to firewall rules instead (probably on the server box)?

I concur.  The only way you could get that message is if the packets
were being summarily dropped before they got to the postmaster.  I
suspect FOlkeN has ipchains or something similar that's configured
not to allow nonlocal traffic to reach port 5432.  (That is the default
configuration on Red Hat Linux 7.2, for example.  Not sure about OSX.)

            regards, tom lane