Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'service postgresql start' fails to start postgres service on Fedora

Tags:

postgresql

Newcomer to postgres here!

I edited pg_hba.conf as mentioned here , but when I try to restart postgresql service, the attempt fails. Below is the command line output with all the information I could gather.

[root@arunpc modules]# service postgresql restart
Redirecting to /bin/systemctl  restart postgresql.service
Job failed. See system logs and 'systemctl status' for details.
[root@arunpc modules]# systemctl status postgresql.service
postgresql.service - PostgreSQL database server
      Loaded: loaded (/lib/systemd/system/postgresql.service; enabled)
      Active: failed since Sun, 08 Apr 2012 21:29:06 +0530; 14s ago
     Process: 12228 ExecStop=/usr/bin/pg_ctl stop -D ${PGDATA} -s -m fast (code=exited, status=0/SUCCESS)
     Process: 12677 ExecStart=/usr/bin/pg_ctl start -D ${PGDATA} -s -o -p ${PGPORT} -w -t 300 (code=exited, status=1/FAILURE)
     Process: 12672 ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)
    Main PID: 12184 (code=exited, status=0/SUCCESS)
      CGroup: name=systemd:/system/postgresql.service
[root@arunpc modules]# tail /var/log/messages
....
Apr  8 21:29:06 arunpc systemd[1]: postgresql.service: control process exited, code=exited status=1
Apr  8 21:29:06 arunpc systemd[1]: Unit postgresql.service entered failed state.
Apr  8 21:29:06 arunpc pg_ctl[12677]: pg_ctl: could not start server
Apr  8 21:29:06 arunpc pg_ctl[12677]: Examine the log output.

FWIW, here is the configuration file (pg_hba.conf) used:

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             postgres                                ident sameuser
local   all             all                                     ident sameuser
# IPv4 local connections:
host    all             all             127.0.0.1               password
# IPv6 local connections:
host    all             all             ::1                     password

What could be the error here? It used to work fine before I made the edit (and since this was a development machine, I brilliantly didn't make any backup).

I would also like to get a more detailed log output. The log message in /var/log/messages file does ask me to "Examine the log output" - which log output would this be? What other troubleshooting steps can I take?

Many thanks in advance!

like image 306
ARV Avatar asked Apr 08 '12 16:04

ARV


1 Answers

Depending on your startup script, it might redirect the postmaster's output to a file. This is usually server.log in the PGDATA directory. Things I'd try:

  • Comment out everything in pg_hba.conf and retry. If the problem is a syntax error in that file, then commenting out the offending line will allow the server to start and then you'll be able to uncomment one at a time until you find the error.

  • Start postmaster directly from the shell without sending it to the background. Just run postmaster -D <pgdata dir> and it should spew some more helpful logs.

like image 183
Alex Howansky Avatar answered Nov 15 '22 07:11

Alex Howansky