PostgreSQL Does not auto start on reboot

Allegheny

Member
Oct 1, 2011
5
0
51
cPanel Access Level
Root Administrator
I know I must be missing something really simple - but, I cannot get PostgreSQL to start on boot.

After a reboot - If I log into WHM and go to restart services and click restart PGSQL it starts fine and runs until the next time the server reboots.

Under chkconfig "postgresql" is listed as "on" for 2,3,4,5 and "off" for 0,1,6

I installed using the CPanel guide at: Installing or Updating PostgreSQL on Your cPanel & WHM Server

...and it seems to be working fine except it just will not autostart on boot.

I am running RedHat Enterprise 6.1 and CPanel 11.30.4 (build 6)

Error log from /var/lib/pgsql/pgstartup.log

FATAL: shmat(id=0) failed: Cannot allocate memory

But again - if a click "restart postgresql" from within CPanel it starts with no problems

Not a major crisis or anything - but I keep forgetting to turn it back on after a reboot
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
348
somewhere over the rainbow
cPanel Access Level
Root Administrator
Would you be able to open up a ticket to see if this might be an issue with RHEL 6.1 specifically? You can submit a ticket using WHM > Support Center > Contact cPanel or using the link in my signature. Thanks!
 

Allegheny

Member
Oct 1, 2011
5
0
51
cPanel Access Level
Root Administrator
For now I am going with telling WHM to monitor Postgres and set it to auto restart the service - and that is working.

From Support: "if you "Monitor" checked for PostgreSQL in WHM -> Service Configuration -> Service Manger, chkservd should restart it within 5 minutes of the server booting"

The also suggested: "Are you familiar with how the service startup scripts have an order of execution. You can try to rename the restart scripts for postgres that are in rc3.d. For example, on my test CentOS server:

[[email protected]]-[~]#ls -al /etc/rc3.d/ | grep post
lrwxrwxrwx 1 root root 20 Sep 21 07:46 S64postgresql -> ../init.d/postgresql*

If this was renamed to S98postgresql, then it would be one of the last services to start. It may be that something else needs to start before postgres starts

-- This I have not done yet; but does sound like a good suggestion.
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
348
somewhere over the rainbow
cPanel Access Level
Root Administrator
Can you reopen the ticket or can bazzi please open up a ticket and note I requested the reopening / opening? I would like to check if this is CentOS 6 specific. When I reboot my machine on CentOS 5, postgresql is restarting properly due to being setup in chkconfig for the boot levels required. Now, if it isn't starting properly due to some memory issue or limit (such as a ulimit) for postgres user, I would like to see why that is for CentOS 6. I believe that might require an internal case, which didn't occur on the ticket originally opened.
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
348
somewhere over the rainbow
cPanel Access Level
Root Administrator
I've replied to the ticket. There's a possible issue with the following entry in /var/lib/pgsql/data/postgresql.conf file:

Code:
shared_buffers = 24MB # min 128kB
I've asked if we can reinstall postgresql on your machine to see if we are using that setting. Currently, I fixed that setting by changing to 1000:

Code:
shared_buffers = 1000 # min 128kB
I then was able to restart postgresql using the reboot startup script it uses:

Code:
/etc/rc.d/init.d/postgresql start
Of note, our script actually uses a different command to start and that's why it was working to startup postgresql in WHM:

Code:
/scripts/restartsrv_postgres