Page 1 of 2

Postgresql Will Not Start

Posted: Wed May 09, 2012 3:49 pm
by easy2kent
Hello,

I am having a problem getting postgresql to start and thus connecting to Nagios. Everything works fine and then when I get to the login screen and try to login I get this: DB Connect Error [nagiosxi]: Database connection failed. Everything started fine except postgresql, I found a post in the FAQ about the PATH and I do not know if I am not doing it right but the PATH seems to be fine. I was wondering if there was something else I have to change?

Thanks,
Kent

Re: Postgresql Will Not Start

Posted: Wed May 09, 2012 3:54 pm
by scottwilkerson
Try running the following command

Code: Select all

psql nagiosxi nagiosxi -c 'vacuum;'

Re: Postgresql Will Not Start

Posted: Thu May 10, 2012 7:28 am
by easy2kent
I ran that command and here is the output:

psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

Re: Postgresql Will Not Start

Posted: Thu May 10, 2012 9:20 am
by mguthrie
Try

Code: Select all

service postgresql restart

Re: Postgresql Will Not Start

Posted: Thu May 10, 2012 9:45 am
by easy2kent
Stopping postgresql service: [FAILED]
Initializing database: mkdir: cannot create directory `/var/lib/pgsql/data/pg_log': File exists
[FAILED]
Starting postgresql service: [FAILED]

Think I might just have to scrap it and call it a day, but any suggestions would be appreciated.

Thanks,
Kent

Re: Postgresql Will Not Start

Posted: Thu May 10, 2012 9:48 am
by mguthrie
Hmm, can you post the output from:

Code: Select all

umask
Is this a new install, or did this just start acting up recently on an existing system?

Re: Postgresql Will Not Start

Posted: Thu May 10, 2012 10:55 am
by easy2kent
0022
It is an existing install but there was some problems with snapshots and the Virtual Machine and I lost some data so I tried to rebuild the Virtual Machine and everything works fine but this issue arose.

Thanks

Re: Postgresql Will Not Start

Posted: Thu May 10, 2012 11:17 am
by mguthrie
It looks like the postgresql init script creates that directory and sets it up, lets try removing it and seeing if that takes care of the issue, if not we'll probably look at re-installing postgres (the data would remain preserved).

Code: Select all

rm -rf /var/lib/pgsql/data/pg_log

Re: Postgresql Will Not Start

Posted: Thu May 10, 2012 1:51 pm
by easy2kent
I got postgresql to start but now am getting this error
psql: FATAL: could not open relation 1663/16385/1259: Permission denied
when I run the command: psql nagiosxi nagiosxi -c 'vacuum;'

So some progress but I cannot get the permissions straightened out.

Thanks again

Re: Postgresql Will Not Start

Posted: Thu May 10, 2012 2:57 pm
by scottwilkerson
Can you connect to psql without a command?

Code: Select all

psql nagiosxi nagiosxi
If so, run

Code: Select all

VACUUM ANALYZE;
If no errors (warnings are ok) run

Code: Select all

VACUUM FULL;