Postgres 9.2.1, RT 4.0.5 - RT couldn't connect to database

Fresh install of Centos 6.3, fully patched. Added the postgresql repo and installed posgresql-9.2.1. RT 4.0.5 is config’d and looks ready to go. Just one last problem…

If I start the standalone rt-server (/opt/rt4/sbin/rt-server -port 8080), I can connect to RT and login as root without a problem. However, apache fails to start with the following error:

[root@tracker rt4]# service httpd start
Starting httpd: DBI connect(‘dbname=rt4;host=localhost’,‘rt_user’,…) failed: could not connect to server: Permission denied
Is the server running on host “localhost” (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Permission denied
Is the server running on host “localhost” (127.0.0.1) and accepting
TCP/IP connections on port 5432? at /usr/local/share/perl5/DBIx/SearchBuilder/Handle.pm line 103.

RT couldn’t connect to the database where tickets are stored.
If this is a new installation of RT, you should visit the URL below
to configure RT and initialize your database.

If this is an existing RT installation, this may indicate a database
connectivity problem.

The error RT got back when trying to connect to your database was:

Connect Failed could not connect to server: Permission denied
Is the server running on host “localhost” (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Permission denied
Is the server running on host “localhost” (127.0.0.1) and accepting
TCP/IP connections on port 5432?
at /opt/rt4/sbin/…/lib/RT.pm line 165.

/var/lib/postgresql-9.2/data/pg_hba.conf has the following line:
host all all 127.0.0.1/32 md5

/var/lib/postgresql-9.2/data/postgresql.conf has the following lines:
listen_addresses = '*'
port = 5432

The database rt4 exists, rt_user database password is matches the one in RT_SiteConfig.pm

What have I overlooked in the httpd config? I can get the basic “It’s running” page but that’s it. It’s puzzling to me that the standalone server works but apache doesn’t.

Thanks,
Mike

Fresh install of Centos 6.3, fully patched. Added the postgresql repo
and installed posgresql-9.2.1. RT 4.0.5 is config’d and looks ready to
go. Just one last problem…

If I start the standalone rt-server (/opt/rt4/sbin/rt-server –port
8080), I can connect to RT and login as root without a problem.
However, apache fails to start with the following error:

[root@tracker rt4]# service httpd start

Starting httpd: DBI connect(‘dbname=rt4;host=localhost’,‘rt_user’,…)
failed: could not connect to server: Permission denied

   Is the server running on host "localhost" (::1) and accepting

   TCP/IP connections on port 5432?

could not connect to server: Permission denied

At the risk of teaching my grandmother to suck eggs, have you:

  • created the PosetrgreSQL database rt4
  • created the user rt_user and granted rights to rt4
  • updated pg_hba.conf to suit?
  • tested with “psql -u rt_user rt4”?

Regards
Graeme

Fresh install of Centos 6.3, fully patched. Added the postgresql repo
and installed posgresql-9.2.1. RT 4.0.5 is config’d and looks ready to
go. Just one last problem…

I suspect SELinux shenanigans. Try disabling SELinux and trying again.

  • Alex

Haha, it’s nice to have a laugh after beating my head against this most of the pm.

Well, I ran “make initialize-database” and it completed successfully. The rt4 database exists, as does rt_user.
If I su to rt_user, I can do this:

[root@tracker ~]# su -l rt_user
[rt_user@tracker ~]$ psql -d rt4 -U rt_user
psql (9.2.1)
Type “help” for help.

rt4=> \q

As the postgres user, I GRANT’ed ALL PRIVILEGES ON DATABASE rt4 TO rt_user;

But apache still won’t start :)-----Original Message-----
From: Graeme Ruthven [mailto:graeme@kula.co.nz]
Sent: Tuesday, October 16, 2012 5:32 PM
To: rt-users@lists.bestpractical.com
Cc: rt-users@lists.bestpractical.com; Mike James
Subject: Re: [rt-users] postgres 9.2.1, RT 4.0.5 - RT couldn’t connect to database

On Tue, 2012-10-16 at 20:55 +0000, Mike James wrote:
At the risk of teaching my grandmother to suck eggs, have you:

  • created the PosetrgreSQL database rt4
  • created the user rt_user and granted rights to rt4
  • updated pg_hba.conf to suit?
  • tested with “psql -u rt_user rt4”?

Regards
Graeme

[root@tracker ~]# su -l rt_user
[rt_user@tracker ~]$ psql -d rt4 -U rt_user
psql (9.2.1)
Type “help” for help.

How about if you try

psql -H localhost -U rt_user rt4

That will tell you if you’ve configured postgres to accept tcp/ip
connections (as well as the default unix domain sockets).

http://www.linkedin.com/in/paultomblin
http://careers.stackoverflow.com/ptomblin