Обсуждение: psql: could not connect to server: Network is unreachable

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

psql: could not connect to server: Network is unreachable

От
markos
Дата:
        Is the server running on host "localhost" and accepting
        TCP/IP connections on port 5432?

Now, I'm really confused because I used to have postgre 7 installed on
my Debian without any serious problems with the configuration. Right
now, I'm using Ubuntu Breezy and postgre 8.

I have used the sample .conf files to set my own
at /var/lib/postgres/data

the only two un-commented lines at the postgresql.conf are :

listen_addresses = 'localhost'  # what IP interface(s) to listen on;
                                # defaults to localhost, '*' = any
port = 5432

And my pg_hba.conf is :

# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD
local   all         all                               trust
# The same using local loopback TCP/IP connections.
#
# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD
host    all         all         127.0.0.1/32          trust
host    all         all         ::1/128               trust

The command I issue to get this reply is :
psql -h localhost -U markulis

Also, I don't know if it is of any importance, but if I issue the
command while online, it simply hangs. I have also experienced the same
problem while trying to connect from pgadmin3.

I really need some help on this, because I have to present my diploma
work in short time and the system doesn't work.


Re: psql: could not connect to server: Network is unreachable

От
Pandurangan R S
Дата:
Hi,

can you check if postmaster is running on your machine using the
following command
ps -aef | grep postmaster

Also check check if postgres is listening on port 5432 using
netstat -na | grep ':5432'


On 1/4/06, markos <el96645@mail.ntua.gr> wrote:
>         Is the server running on host "localhost" and accepting
>         TCP/IP connections on port 5432?
>
> Now, I'm really confused because I used to have postgre 7 installed on
> my Debian without any serious problems with the configuration. Right
> now, I'm using Ubuntu Breezy and postgre 8.
>
> I have used the sample .conf files to set my own
> at /var/lib/postgres/data
>
> the only two un-commented lines at the postgresql.conf are :
>
> listen_addresses = 'localhost'  # what IP interface(s) to listen on;
>                                 # defaults to localhost, '*' = any
> port = 5432
>
> And my pg_hba.conf is :
>
> # TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD
> local   all         all                               trust
> # The same using local loopback TCP/IP connections.
> #
> # TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD
> host    all         all         127.0.0.1/32          trust
> host    all         all         ::1/128               trust
>
> The command I issue to get this reply is :
> psql -h localhost -U markulis
>
> Also, I don't know if it is of any importance, but if I issue the
> command while online, it simply hangs. I have also experienced the same
> problem while trying to connect from pgadmin3.
>
> I really need some help on this, because I have to present my diploma
> work in short time and the system doesn't work.
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
>        choose an index scan if your joining column's datatypes do not
>        match
>

Re: psql: could not connect to server: Network is unreachable

От
Tom Lane
Дата:
markos <el96645@mail.ntua.gr> writes:
>         Is the server running on host "localhost" and accepting
>         TCP/IP connections on port 5432?

Please show the *entire* error message, not just the part you think
is important.

            regards, tom lane

Re: psql: could not connect to server: Network is

От
markos
Дата:
First of all, thanks for the swift replies.

The whole error message is actually this :

psql -h localhost -U markulis

psql: could not connect to server: Network is unreachable
        Is the server running on host "localhost" and accepting
        TCP/IP connections on port 5432?


the result of :
ps -aef | grep postmaster

is

postgres  8702     1  0 19:08 pts/1
00:00:00 /usr/lib/postgresql/8.0/bin/postmaster
-D /var/lib/postgresql/8.0/main -c
unix_socket_directory=/var/run/postgresql -c
config_file=/etc/postgresql/8.0/main/postgresql.conf -c
hba_file=/etc/postgresql/8.0/main/pg_hba.conf -c
ident_file=/etc/postgresql/8.0/main/pg_ident.conf
root      8811  8560  0 19:17 pts/1    00:00:00 grep postmaster


what I realized from this is that postmaster uses diferrent .conf files
than what I thought. Yet, I changed them too and nothing happened.
(The postgresql.conf on this directory had
listen_addresses = 'localhost'
commented out, but the default is localhost anyway)

the result of :
netstat -na | grep ':5432'

is nothing

I suppose that this suggests postmaster is not listening to port 5432.
But both postgresql.conf that I have on my system have the line
port = 5432








Re: psql: could not connect to server: Network is

От
Tom Lane
Дата:
markos <el96645@mail.ntua.gr> writes:
> psql -h localhost -U markulis
> psql: could not connect to server: Network is unreachable
>         Is the server running on host "localhost" and accepting
>         TCP/IP connections on port 5432?

Hm.  "Network is unreachable" means that you have got a networking
problem not a database problem.  You'll probably find that simple
commands like "ping localhost" don't work either.  The problem could
be a DNS issue --- what does "nslookup localhost" say?  If it comes
back with something reasonable, then you've got a kernel
misconfiguration issue, which I don't think I can help you with.

            regards, tom lane

Re: psql: could not connect to server: Network is

От
markos
Дата:
On Wed, 2006-01-04 at 12:51 -0500, Tom Lane wrote:
> markos <el96645@mail.ntua.gr> writes:
> > psql -h localhost -U markulis
> > psql: could not connect to server: Network is unreachable
> >         Is the server running on host "localhost" and accepting
> >         TCP/IP connections on port 5432?
>
> Hm.  "Network is unreachable" means that you have got a networking
> problem not a database problem.  You'll probably find that simple
> commands like "ping localhost" don't work either.  The problem could
> be a DNS issue --- what does "nslookup localhost" say?  If it comes
> back with something reasonable, then you've got a kernel
> misconfiguration issue, which I don't think I can help you with.
>
>             regards, tom lane

Thanks a lot. You were actually right, the network was down. I just had
to give the command : "sudo ifup lo". I just couldn't narrow my search
until you made sure that postgre is ok, so thanks again