Thread: connecting from trac: "no route to host" error

connecting from trac: "no route to host" error

From
Ivan Uemlianin
Date:
Dear All

I am trying to set up trac with postgresql.  However, in trac-admin
initenv I am receiving a "no route to host" error:


Database connection string [sqlite:db/trac.db]>
postgres://tdb_user:tdb_pass@locahost/tdb_dbname

Creating and Initializing Project
Initenv for '/opt/trac/pgtest' failed.
Failed to create environment.
could not connect to server: No route to host
     Is the server running on host "locahost" and accepting
     TCP/IP connections on port 5432?

Traceback (most recent call last):
   File "build/bdist.linux-x86_64/egg/trac/admin/console.py", line 413,
in do_initenv
     options=options)
   File "build/bdist.linux-x86_64/egg/trac/env.py", line 221, in __init__
     self.create(options)
   File "build/bdist.linux-x86_64/egg/trac/env.py", line 410, in create
     DatabaseManager(self).init_db()
   File "build/bdist.linux-x86_64/egg/trac/db/api.py", line 87, in init_db
     connector.init_db(**args)
   File "build/bdist.linux-x86_64/egg/trac/db/postgres_backend.py", line
98, in init_db
     params)
   File "build/bdist.linux-x86_64/egg/trac/db/postgres_backend.py", line
87, in get_connection
     params)
   File "build/bdist.linux-x86_64/egg/trac/db/postgres_backend.py", line
203, in __init__
     port))
OperationalError: could not connect to server: No route to host
     Is the server running on host "locahost" and accepting
     TCP/IP connections on port 5432?


trac-admin is happy with sqlite.
I can login to postgresql using psql.
I have disabled iptables and selinux (It's all on a centos machine).
Stopping my web server (nginx) makes no difference.

ping localhost works but indeed ping localhost 5432 does not (receives
no packets).  However, postgresql.conf has:

listen_addresses = 'localhost'
port = 5432

I have the feeling I'm missing something obvious (I have read the FAQ,
Googled, etc.).  Please can anyone advise?

With thanks and best wishes

Ivan

--
============================================================
Ivan A. Uemlianin
Speech Technology Research and Development

                     ivan@llaisdy.com
                      www.llaisdy.com
                          llaisdy.wordpress.com
                      www.linkedin.com/in/ivanuemlianin

     "Froh, froh! Wie seine Sonnen, seine Sonnen fliegen"
                      (Schiller, Beethoven)
============================================================


Re: connecting from trac: "no route to host" error

From
Devrim GÜNDÜZ
Date:
On Thu, 2010-05-13 at 15:15 +0100, Ivan Uemlianin wrote:
>
> Creating and Initializing Project
> Initenv for '/opt/trac/pgtest' failed.
> Failed to create environment.
> could not connect to server: No route to host
>      Is the server running on host "locahost" and accepting
>      TCP/IP connections on port 5432?

locahost != localhost ;)

--
Devrim GÜNDÜZ
PostgreSQL Danışmanı/Consultant, Red Hat Certified Engineer
PostgreSQL RPM Repository: http://yum.pgrpms.org
Community: devrim~PostgreSQL.org, devrim.gunduz~linux.org.tr
http://www.gunduz.org  Twitter: http://twitter.com/devrimgunduz


Re: connecting from trac: "no route to host" error

From
Tom Lane
Date:
Ivan Uemlianin <ivan@llaisdy.com> writes:
> could not connect to server: No route to host
>      Is the server running on host "locahost" and accepting
>      TCP/IP connections on port 5432?

This is a networking setup problem, not a Postgres problem.
"ifconfig lo" might show something useful.  On a functioning
Fedora box I get

$ ifconfig lo
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:1326801 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1326801 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:392324376 (374.1 MiB)  TX bytes:392324376 (374.1 MiB)


If no joy there, try checking just what "localhost" is resolving as.

            regards, tom lane

PS: I trust "locahost" above is a copy and paste error, else that's
probably your problem.

Re: connecting from trac: "no route to host" error

From
Ivan Uemlianin
Date:
Oh no I don't believe it!  That was the problem.  :Die of embarrassment:

Um,

     postgres://trac_db_user:trac_db_pass@localhost/trac_db_name

... works perfectly.

Many thanks and even more apologies!

Ivan


On 13/05/2010 15:46, Devrim GÜNDÜZ wrote:
> On Thu, 2010-05-13 at 15:15 +0100, Ivan Uemlianin wrote:
>
>> Creating and Initializing Project
>> Initenv for '/opt/trac/pgtest' failed.
>> Failed to create environment.
>> could not connect to server: No route to host
>>       Is the server running on host "locahost" and accepting
>>       TCP/IP connections on port 5432?
>>
> locahost != localhost ;)
>
>


--
============================================================
Ivan A. Uemlianin
Speech Technology Research and Development

                     ivan@llaisdy.com
                      www.llaisdy.com
                          llaisdy.wordpress.com
                      www.linkedin.com/in/ivanuemlianin

     "Froh, froh! Wie seine Sonnen, seine Sonnen fliegen"
                      (Schiller, Beethoven)
============================================================