Skip navigation

PostgreSQL shutting down by itself

2104 Views 14 Replies Latest reply: Aug 24, 2012 8:23 AM by DarKOrange RSS
DarKOrange Calculating status...
Currently Being Moderated
Aug 21, 2012 6:38 AM

Hi all,

 

I've an issue with PostgrSQL.

I've made a clean install of OS X 10.8 server and set up PostgreSQL accordingly to the post in this thread :

 

https://discussions.apple.com/thread/4153247?start=0&tstart=0

 

First I have to start PostgreSQL manually when I start the server.

The it runs for a few minutes and shuts down... i can restart it and it shutsdown again etc.

 

I need help! Thank you!

 

Here is the postgrSQL.log file

 

2012-08-21 08:51:33 CEST LOG:  database system is shut down

2012-08-21 09:51:17 CEST LOG:  database system was shut down at 2012-08-21 08:51:33 CEST

2012-08-21 09:51:17 CEST LOG:  autovacuum launcher started

2012-08-21 09:51:17 CEST LOG:  database system is ready to accept connections

2012-08-21 09:51:19 CEST LOG:  connection received: host=[local]

2012-08-21 09:51:19 CEST LOG:  connection authorized: user=_devicemgr database=device_management

2012-08-21 09:51:20 CEST LOG:  received smart shutdown request

2012-08-21 09:51:20 CEST LOG:  autovacuum launcher shutting down

2012-08-21 09:51:20 CEST LOG:  shutting down

2012-08-21 09:51:20 CEST LOG:  database system is shut down

2012-08-21 09:51:21 CEST LOG:  database system was shut down at 2012-08-21 09:51:20 CEST

2012-08-21 09:51:21 CEST LOG:  database system is ready to accept connections

2012-08-21 09:51:21 CEST LOG:  autovacuum launcher started

2012-08-21 09:51:21 CEST LOG:  connection received: host=[local]

2012-08-21 09:51:21 CEST LOG:  connection authorized: user=collab database=collab

2012-08-21 09:51:22 CEST LOG:  connection received: host=[local]

2012-08-21 09:51:22 CEST LOG:  connection authorized: user=collab database=collab

2012-08-21 09:51:22 CEST LOG:  received smart shutdown request

2012-08-21 09:51:22 CEST LOG:  autovacuum launcher shutting down

2012-08-21 09:51:22 CEST LOG:  shutting down

2012-08-21 09:51:22 CEST LOG:  database system is shut down

2012-08-21 09:51:23 CEST LOG:  database system was shut down at 2012-08-21 09:51:22 CEST

2012-08-21 09:51:23 CEST LOG:  autovacuum launcher started

2012-08-21 09:51:23 CEST LOG:  database system is ready to accept connections

2012-08-21 09:51:25 CEST LOG:  connection received: host=[local]

2012-08-21 09:51:25 CEST LOG:  connection authorized: user=_devicemgr database=device_management

2012-08-21 09:51:25 CEST LOG:  received smart shutdown request

2012-08-21 09:51:25 CEST LOG:  autovacuum launcher shutting down

2012-08-21 09:51:25 CEST LOG:  shutting down

2012-08-21 09:51:25 CEST LOG:  database system is shut down

2012-08-21 09:51:33 CEST LOG:  database system was shut down at 2012-08-21 09:51:25 CEST

2012-08-21 09:51:33 CEST LOG:  database system is ready to accept connections

2012-08-21 09:51:33 CEST LOG:  autovacuum launcher started

2012-08-21 09:51:33 CEST LOG:  connection received: host=[local]

2012-08-21 09:51:33 CEST LOG:  connection authorized: user=collab database=collab

2012-08-21 09:51:33 CEST LOG:  connection received: host=[local]

2012-08-21 09:51:33 CEST LOG:  connection authorized: user=collab database=collab

2012-08-21 09:51:33 CEST LOG:  received smart shutdown request

2012-08-21 09:51:33 CEST LOG:  autovacuum launcher shutting down

2012-08-21 09:51:33 CEST LOG:  shutting down

2012-08-21 09:51:33 CEST LOG:  database system is shut down

2012-08-21 10:27:06 CEST LOG:  database system was shut down at 2012-08-21 09:51:33 CEST

2012-08-21 10:27:06 CEST LOG:  database system is ready to accept connections

2012-08-21 10:27:06 CEST LOG:  autovacuum launcher started

2012-08-21 10:27:06 CEST LOG:  connection received: host=[local]

2012-08-21 10:27:06 CEST LOG:  connection authorized: user=_postgres database=postgres

Mac mini, OS X Server
  • redshift82r Level 2 Level 2 (325 points)
    Currently Being Moderated
    Aug 21, 2012 3:52 PM (in response to DarKOrange)

    OK - 1st thing to do is to up the debug level a little in postgres.

     

    using your favourite editor, add the last 2 lines of <string> ( -d  and 2) to /library/server/postgresql/config/org.postgresql.postgres.plist

     

     

     

    <?xml version="1.0" encoding="UTF-8"?>

    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

    <plist version="1.0">

    <dict>

              <key>ProgramArguments</key>

              <array>

                        <string>-D</string>

                        <string>/Library/Server/PostgreSQL/Data</string>

                        <string>-c</string>

                        <string>listen_addresses=127.0.0.1</string>

                        <string>-c</string>

                        <string>log_connections=on</string>

                        <string>-c</string>

                        <string>log_directory=/Library/Logs/PostgreSQL</string>

                        <string>-c</string>

                        <string>log_filename=PostgreSQL.log</string>

                        <string>-c</string>

                        <string>log_lock_waits=on</string>

                        <string>-c</string>

                        <string>log_statement=ddl</string>

                        <string>-c</string>

                        <string>log_line_prefix=%t </string>

                        <string>-c</string>

                        <string>logging_collector=on</string>

                        <string>-c</string>

                        <string>unix_socket_directory=/var/pgsql_socket</string>

                        <string>-c</string>

                        <string>unix_socket_group=_postgres</string>

                        <string>-c</string>

                        <string>unix_socket_permissions=0770</string>

                        <string>-d</string>

                        <string>2</string>

              </array>

    </dict>

    </plist>

     

    Debug levels go from 1-5 , but 2 should be sufficient for now

     

    stop and start postgres from serveradmin

     

    $ sudo serveradmin stop postgres

    $ sudo serveradmin start postgres

    You may want to also while you are fault-finding change the group permissions on the postgresql.log which allows it to be seen inside console.app

     

    $ sudo chown _postgres:admin /library/logs/postgresql/postgresql.log

     

    and have a look at the postgresql.log  and report back.  Also have a look in system.log for any activity around the time of starting postgres and see what is happening there.

     

    You can always up the debug level for postgres to 3, 4 or 5 if you need more info.  I'm still voting for a permissions, mis-config or resources issue, but lets take it step by step - might also be worth checking the plist above against yours and make sure its the same ( with any differences for where you set your server path)

     

    cheers

    Gerry

  • redshift82r Level 2 Level 2 (325 points)
    Currently Being Moderated
    Aug 22, 2012 2:18 PM (in response to DarKOrange)

    Not convinced about backup being the issue although that doesnt look healthy.

     

    New plan.

     

    Turn your debug level back to "1" for Postgres.

     

    Start turning off 1 server service at a time ( wiki, profile manager, address book, calendar) and stop / start Postgres and see if it stays running.  Try and narrow it down that way.

  • iToaster Level 3 Level 3 (560 points)
    Currently Being Moderated
    Aug 23, 2012 6:24 AM (in response to DarKOrange)

    I read somewhere ML server shuts postgres down to enable a proper TM backup when TM runs

    and restarts it. Unlike previous incarnations of OSX server were TM was not recommend because it didn't completely back up the file system. because the various databases were still running. 

  • iToaster Level 3 Level 3 (560 points)
    Currently Being Moderated
    Aug 23, 2012 7:57 AM (in response to DarKOrange)

    is TM finishing the backup, I've had the odd problem in the past were TM seems to runaway with itself

    stuck indexing files and I've had to eraze the TM drve and start again.other times I've had drive poblems which again stopped TM from finishing.

     

    I don't know how postgres backup is handled by TM, if it's a snapshot or if it's shutdown the whole time TM or what smarts it has if postgres receives a request when TM is trying to back it up or if it can handle none apple additions to the db like roundube

     

    redshift82r is the postgres guru

     

    according to this kb article it's  suposed to backup the OD and postges daily

     

    http://support.apple.com/kb/HT5139

     

    Time Machine is the native backup service for OS X Server. OS X  Server also includes a process called ServerBackup which works with Time Machine. ServerBackup performs daily backups of Open Directory (if it is enabled) and the Postgres databases used by the Calendar (or iCal), Contacts (or Address Book), Profile Manager, and Wiki services. These daily backups are included in the Time Machine backup of Lion Server. ServerBackup also takes part in the restoration of server services, running during the first startup after a server has been restored, and restoring server services and databases into place after the server has started up.

  • redshift82r Level 2 Level 2 (325 points)
    Currently Being Moderated
    Aug 23, 2012 2:17 PM (in response to DarKOrange)

    The differences in behavior might be down to clean install vs migration.  My server was an update of 10.7.4 not a clean install.  There will be a script within server.app/contents somewhere for server backup. Might be worth a poke around.

  • redshift82r Level 2 Level 2 (325 points)
    Currently Being Moderated
    Aug 23, 2012 4:03 PM (in response to iToaster)

    Have a look at  server.app/contents/serverroot/private/etc/server_backup/

     

    You mentioned that you had done a "clean install" but did you then migrate settings from a previous server?

    The HT article mentions that

     

    ServerBackup also takes part in the restoration of server services, running during the first startup after a server has been restored, and restoring server services and databases into place after the server has started up.

    Maybe it didn't run cleanly on first startup, thus shutting down postgres.  Is postgres starting by itself now on startup after reboot?

  • redshift82r Level 2 Level 2 (325 points)
    Currently Being Moderated
    Aug 23, 2012 4:06 PM (in response to iToaster)

    If it is a clean install, why not delete server.app and re-install and see what happens?

  • AnalogKid Level 1 Level 1 (10 points)
    Currently Being Moderated
    Aug 24, 2012 1:16 AM (in response to DarKOrange)

    I'm just digging into Postgres and Roundcube myself, but one thing I've noticed is that Postgres only runs when certain services are turned on in Server.app.  I had to enable ProfileManager to get Postgres to come up.  Presumably there's a launched plist I can fiddle somewhere to get around that, but I'm wondering if that relates to this problem: if you're turning on the database using serveradmin rather than enabling a magic service, and TimeMachine is shutting it down, does TimeMachine know it needs to start it back up again?

  • redshift82r Level 2 Level 2 (325 points)
    Currently Being Moderated
    Aug 24, 2012 2:18 AM (in response to AnalogKid)

    Great pickup! I run profile mgr, calendar, addressbook and wiki, any which will turn Postgres on.

Actions

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.