Обсуждение: Problem Connecting to 5432

Поиск
Список
Период
Сортировка

Problem Connecting to 5432

От
"Casey, J Bart"
Дата:

All,

 

I have read message after message and searched the internet for hours, yet I still can’t get a remote computer to connect to port 5432 on my Fedora Core 3 system running Postgresql 7.4.7.

 

What I have done:

 

1) Stopped the iptables service

 

2) Modified postgresql.conf and added the following lines

            tcpip_socket = true

            port = 5432

 

3) Modified pg_hba.conf and added

            host       all         all   (my ip address)       255.255.255.255               trust

 

4) Modified the postgresql startup script to use the –i flag

 

5) Verified that postmaster is running with the –i flag…  ps ax | grep postmaster output:

            4259 pts/1    S      0:00 /usr/bin/postmaster -p 5432 -D /var/lib/pgsql/data –i

 

6) Tried to verify that the server was listening on port 5432 only to find out that it isn’t.  The netstat output follows:

            tcp        0      0 127.0.0.1:8438              0.0.0.0:*                   LISTEN     

tcp        0      0 127.0.0.1:5432              0.0.0.0:*                   LISTEN     

tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN     

tcp        0      0 :::80                       :::*                        LISTEN     

tcp        0      0 :::22                       :::*                        LISTEN      

tcp        0      0 :::443                      :::*                        LISTEN  

 

As you can see it is only listening on the loopback interface

 

 

I’m quite certain the issue is how I am starting the service, but I’ve added the –i flag.

 

 

I’m all out of ideas on this one.  Any and all help is greatly appreciated.

 

Regards,

 

Bart  

Re: Problem Connecting to 5432

От
louis gonzales
Дата:
Try using the following format in the pg_hba.conf file:

host all all(or your_user_account) your_IP/32 trust (The 32 is the same
as 255.255.255.255 but in CIDR format)

As for the command line you started postmaster with, doesn't the "-i"
require an interface such as an IP address too? If you look below in
your comments, you specify "-i" after your DATA directory but never give
the "-i" an argument?



Casey, J Bart wrote:

> All,
>
> I have read message after message and searched the internet for hours,
> yet I still can’t get a remote computer to connect to port 5432 on my
> Fedora Core 3 system running Postgresql 7.4.7.
>
> What I have done:
>
> 1) Stopped the iptables service
>
> 2) Modified postgresql.conf and added the following lines
>
> tcpip_socket = true
>
> port = 5432
>
> 3) Modified pg_hba.conf and added
>
> host all all (my ip address) 255.255.255.255 trust
>
> 4) Modified the postgresql startup script to use the –i flag
>
> 5) Verified that postmaster is running with the –i flag… ps ax | grep
> postmaster output:
>
> 4259 pts/1 S 0:00 /usr/bin/postmaster -p 5432 -D /var/lib/pgsql/data –i
>
> 6) Tried to verify that the server was listening on port 5432 only to
> find out that it isn’t. The netstat output follows:
>
> tcp 0 0 127.0.0.1:8438 0.0.0.0:* LISTEN
>
> tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN
>
> tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
>
> tcp 0 0 :::80 :::* LISTEN
>
> tcp 0 0 :::22 :::* LISTEN
>
> tcp 0 0 :::443 :::* LISTEN
>
> As you can see it is only listening on the loopback interface
>
> I’m quite certain the issue is how I am starting the service, but I’ve
> added the –i flag.
>
> I’m all out of ideas on this one. Any and all help is greatly appreciated.
>
> Regards,
>
> Bart
>


Re: Problem Connecting to 5432

От
louis gonzales
Дата:
My mistake, the "-h host_IP" explicitly states which IP address to
listen on.

/usr/bin/postmaster -h your_IP -p 5432 -D /var/lib/pgsql/data –i

I'm not sure if postgresql v7.x.y already used the pg_ctl command which
is essentially a wrapper for postmaster, if so use,

pg_ctl -w -o "-h your_IP -p your_PORT" -l logfile(if you wish) start

if you use "your_IP = 0.0.0.0" it will listen on all valid TCP/IP
interfaces, including 127.0.0.1(a.k.a. localhost)



louis gonzales wrote:

> Try using the following format in the pg_hba.conf file:
>
> host all all(or your_user_account) your_IP/32 trust (The 32 is the
> same as 255.255.255.255 but in CIDR format)
>
> As for the command line you started postmaster with, doesn't the "-i"
> require an interface such as an IP address too? If you look below in
> your comments, you specify "-i" after your DATA directory but never
> give the "-i" an argument?
>
>
>
> Casey, J Bart wrote:
>
>> All,
>>
>> I have read message after message and searched the internet for
>> hours, yet I still can’t get a remote computer to connect to port
>> 5432 on my Fedora Core 3 system running Postgresql 7.4.7.
>>
>> What I have done:
>>
>> 1) Stopped the iptables service
>>
>> 2) Modified postgresql.conf and added the following lines
>>
>> tcpip_socket = true
>>
>> port = 5432
>>
>> 3) Modified pg_hba.conf and added
>>
>> host all all (my ip address) 255.255.255.255 trust
>>
>> 4) Modified the postgresql startup script to use the –i flag
>>
>> 5) Verified that postmaster is running with the –i flag… ps ax | grep
>> postmaster output:
>>
>> 4259 pts/1 S 0:00 /usr/bin/postmaster -p 5432 -D /var/lib/pgsql/data –i
>>
>> 6) Tried to verify that the server was listening on port 5432 only to
>> find out that it isn’t. The netstat output follows:
>>
>> tcp 0 0 127.0.0.1:8438 0.0.0.0:* LISTEN
>>
>> tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN
>>
>> tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
>>
>> tcp 0 0 :::80 :::* LISTEN
>>
>> tcp 0 0 :::22 :::* LISTEN
>>
>> tcp 0 0 :::443 :::* LISTEN
>>
>> As you can see it is only listening on the loopback interface
>>
>> I’m quite certain the issue is how I am starting the service, but
>> I’ve added the –i flag.
>>
>> I’m all out of ideas on this one. Any and all help is greatly
>> appreciated.
>>
>> Regards,
>>
>> Bart
>>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
>               http://archives.postgresql.org



Re: Problem Connecting to 5432

От
Tom Lane
Дата:
"Casey, J Bart" <CaseyJB@wofford.edu> writes:
> I have read message after message and searched the internet for hours,
> yet I still can't get a remote computer to connect to port 5432 on my
> Fedora Core 3 system running Postgresql 7.4.7.

You need to restart (not just SIGHUP) the postmaster to get it to accept
the tcpip_socket flag.  If you don't see it listening in netstat then
my first guess is you forgot that step.  If it's not apparent what's
happening then you need to look at the postmaster's log output ... which
I think the default configuration in FC3 will deliver to /dev/null :-(
You could tweak the initscript to change that, or start the postmaster
"by hand" from a terminal window to see if it prints any useful messages.

Once you see that it's listening, try "psql -h localhost ..." to see if
a TCP connection actually works.  I am not sure that it will work by
default --- I think that the default iptables firewall configuration on
FC3 disallows connections to 5432.  (Even if they're allowed on local
loopback, they're very likely not allowed remotely.)  So fixing the
iptables configuration will be your second hurdle.

            regards, tom lane

Re: Problem Connecting to 5432

От
"Casey, J Bart"
Дата:
Louis,

Thank you very much for the info on the -h flag.  Somehow I missed that
in the postmaster man pages.  That did the trick!

Regards,

J. Bart Casey

-----Original Message-----
From: louis gonzales [mailto:gonzales@linuxlouis.net]
Sent: Wednesday, June 14, 2006 2:42 AM
To: louis gonzales
Cc: Casey, J Bart; pgsql-general@postgresql.org
Subject: Re: [GENERAL] Problem Connecting to 5432

My mistake, the "-h host_IP" explicitly states which IP address to
listen on.

/usr/bin/postmaster -h your_IP -p 5432 -D /var/lib/pgsql/data -i

I'm not sure if postgresql v7.x.y already used the pg_ctl command which
is essentially a wrapper for postmaster, if so use,

pg_ctl -w -o "-h your_IP -p your_PORT" -l logfile(if you wish) start

if you use "your_IP = 0.0.0.0" it will listen on all valid TCP/IP
interfaces, including 127.0.0.1(a.k.a. localhost)



louis gonzales wrote:

> Try using the following format in the pg_hba.conf file:
>
> host all all(or your_user_account) your_IP/32 trust (The 32 is the
> same as 255.255.255.255 but in CIDR format)
>
> As for the command line you started postmaster with, doesn't the "-i"
> require an interface such as an IP address too? If you look below in
> your comments, you specify "-i" after your DATA directory but never
> give the "-i" an argument?
>
>
>
> Casey, J Bart wrote:
>
>> All,
>>
>> I have read message after message and searched the internet for
>> hours, yet I still can't get a remote computer to connect to port
>> 5432 on my Fedora Core 3 system running Postgresql 7.4.7.
>>
>> What I have done:
>>
>> 1) Stopped the iptables service
>>
>> 2) Modified postgresql.conf and added the following lines
>>
>> tcpip_socket = true
>>
>> port = 5432
>>
>> 3) Modified pg_hba.conf and added
>>
>> host all all (my ip address) 255.255.255.255 trust
>>
>> 4) Modified the postgresql startup script to use the -i flag
>>
>> 5) Verified that postmaster is running with the -i flag... ps ax |
grep
>> postmaster output:
>>
>> 4259 pts/1 S 0:00 /usr/bin/postmaster -p 5432 -D /var/lib/pgsql/data
-i
>>
>> 6) Tried to verify that the server was listening on port 5432 only to

>> find out that it isn't. The netstat output follows:
>>
>> tcp 0 0 127.0.0.1:8438 0.0.0.0:* LISTEN
>>
>> tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN
>>
>> tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
>>
>> tcp 0 0 :::80 :::* LISTEN
>>
>> tcp 0 0 :::22 :::* LISTEN
>>
>> tcp 0 0 :::443 :::* LISTEN
>>
>> As you can see it is only listening on the loopback interface
>>
>> I'm quite certain the issue is how I am starting the service, but
>> I've added the -i flag.
>>
>> I'm all out of ideas on this one. Any and all help is greatly
>> appreciated.
>>
>> Regards,
>>
>> Bart
>>
>
>
> ---------------------------(end of
broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
>               http://archives.postgresql.org