Search Postgresql Archives

Re: Auto Starting +/or Shutdown on OS X

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Apologies for the huge post, but it's got everything relevant that I can think of.
See below.

Michael Glaesemann wrote:

On Jul 31, 2007, at 14:27 , Ralph Smith wrote:

=== INITIAL POST ====================
I'm using scripts in /Library/StartupItems/PostgreSQL

PostgreSQL starts manually just fine via
/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l /usr/local/pgsql/logfile start

What user are you starting the server as? Is this the same user you have specified in the StartupItem/launchd plist?

If I execute the start command above just after a System start I get
  pg_ctl: another server may be running; trying to start server anyway
  server starting
and then it starts and runs fine.

I'm speculating that the StartupItem is trying to start the server but failing.

I'm looking at getting that debugging to log where I can find it.
Can someone help me config extended logging?
log_destination, log_directory, log_filename

I believe you should be able to set these at startup, though I haven't tried.

               <string>/usr/local/pgsql/bin/postmaster</string>
               <string>-D</string>
               <string>/usr/local/pgsql/data</string>
               <string>-l</string>
               <string>/usr/local/pgsql/logfile</string>
               <string>-c</string>
               <string>redirect_stderr=YES</string>
               <string>-c</string>
               <string>log_min_message=DEBUG5</string>
               <string>-c</string>
               <string>log_error_verbosity=VERBOSE</string>

Did you also change the user and group to what's appropriate for your setup?

Michael Glaesemann
grzm seespotcode net
=========================================================
Ralph here again.

The command-line start is via U/G postgres/postgres.
In /Library/LaunchDaemon/... I'm using the same names.
I've removed all references to PG in /Library/StartupItems
- - - - - - - - - - - -
- - - - - - - - - - - -
From tail of /var/log/system.log
Jul 31 16:31:04 swampmac launchd: org.postgresql.postgres.v824: exited with exit code: 1 Jul 31 16:31:04 swampmac launchd: org.postgresql.postgres.v824: respawning too quickly! throttling Jul 31 16:31:04 swampmac launchd: org.postgresql.postgres.v824: 1 more failure without living at least 60 seconds will cause job removal Jul 31 16:31:04 swampmac launchd: org.postgresql.postgres.v824: will restart in 10 seconds Jul 31 16:31:14 swampmac launchd: org.postgresql.postgres.v824: exited with exit code: 1 Jul 31 16:31:14 swampmac launchd: org.postgresql.postgres.v824: respawning too quickly! throttling Jul 31 16:31:14 swampmac launchd: org.postgresql.postgres.v824: too many failures in succession
========================
========================

swampmac:/pgsql_link postgres$   ll -R /Library/LaunchDaemons/
total 8
drwxr-xr-x    3 root  wheel   102 Jul 31 16:10 .
drwxrwxr-t   47 root  admin  1598 Jul 19 16:58 ..
-rw-r--r-- 1 root wheel 3957 Jul 30 16:59 org.postgresql.postgres.v824.plist
========================
========================

swampmac:/pgsql_link postgres$ cat /Library/LaunchDaemons/org.postgresql.postgres.v824.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
<plist version="1.0">
<!-- bulk of comment removed
-->

<dict>
       <key>Label</key>
<!-- Set the Label parameter to a unique string identifying the job to launchd. This is commonly set to the naem of the launchd.plist file
            without the .plist extension.
         -->
       <string>org.postgresql.postgres.v824</string>
       <key>OnDemand</key>
       <false/>
       <key>Disabled</key>
   <!-- Set the OnDemand parameter to <true/> to prevent the server from
starting automatically on system start or when launched by launchctl.
     -->
       <false/>
       <key>ProgramArguments</key>
<!-- The elements of the ProgramArguments parameter array are the command
        line string used to start the server, exploded on white space. No
        string should contain spaces.

        The first element is the absolute path to the postmaster server
        application binary, followed by the argments to be passed to the
        postmaster server application. Add, delete, and update these
parameter strings as needed for your requirements. The example includes
        setting the database data directory (PGDATA) and sets the
        redirect_stderr runtime parameter.
     -->
       <array>
               <string>/usr/local/pgsql/bin/postmaster</string>
               <string>-D</string>
               <string>/usr/local/pgsql/data</string>
               <string>-l</string>
               <string>/usr/local/pgsql/logfile</string>
               <string>-c</string>
               <string>redirect_stderr=YES</string>
               <string>-c</string>
               <string>log_min_message=DEBUG5</string>
               <string>-c</string>
               <string>log_error_verbosity=VERBOSE</string>
       </array>
       <key>ServiceDescription</key>
<!-- The ServiceDescription parameter is a human-readable string to describe the purpose of the service provided, in this case the PostgreSQL dbms
            server.
     -->
       <string>PostgreSQL Server v8.2.4</string>
       <key>UserName</key>
<!-- Set the Username parameter string to the user who is to owns the PostgreSQL
            server process, typically "postgres".
     -->
       <string>postgres</string>
       <key>GroupName</key>
<!-- Set the GroupName parameter to group of the user who is to own the
            PostgreSQL process, typically "postgres".
         -->
       <string>postgres</string>
</dict>
</plist>
===========================
===========================

swampmac:/pgsql_link postgres$ more data/postgresql.conf
# -----------------------------
# PostgreSQL configuration file
# -----------------------------
#
# COMMENTS REMOVED HERE

#---------------------------------------------------------------------------
# FILE LOCATIONS
#---------------------------------------------------------------------------

# The default values of these variables are driven from the -D command line
# switch or PGDATA environment variable, represented here as ConfigDir.

#data_directory = 'ConfigDir'           # use data in another directory
data_directory = '/usr/local/pgsql/data' # use data in another directory
                                       # (change requires restart)

#hba_file = 'ConfigDir/pg_hba.conf' # host-based authentication file hba_file = '/usr/local/pgsql/data/pg_hba.conf' # host-based authentication file
                                       # (change requires restart)
#ident_file = 'ConfigDir/pg_ident.conf' # ident configuration file
                                       # (change requires restart)

# If external_pid_file is not explicitly set, no extra PID file is written.
#external_pid_file = '(none)'           # write an extra PID file
                                       # (change requires restart)


#---------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#---------------------------------------------------------------------------

# - Connection Settings -

listen_addresses = '127.0.0.1, addr1, addr2, addr3' # I have IP addresses here

                                       # what IP address(es) to listen on;
                                       # comma-separated list of addresses;
                                       # defaults to 'localhost', '*' = all
                                       # (change requires restart)
port = 5432                            # (change requires restart)
==========================
==========================

swampmac:/pgsql_link postgres$ more data/pg_hba.conf
# PostgreSQL Client Authentication Configuration File
# ===================================================
#
# Refer to the "Client Authentication" section in the
# PostgreSQL documentation for a complete description
# of this file.  A short synopsis follows.
#
# This file controls: which hosts are allowed to connect, how clients
# are authenticated, which PostgreSQL user names they can use, which
# databases they can access.  Records take one of these forms:
#
# local      DATABASE  USER  METHOD  [OPTION]
# host       DATABASE  USER  CIDR-ADDRESS  METHOD  [OPTION]
# hostssl    DATABASE  USER  CIDR-ADDRESS  METHOD  [OPTION]
# hostnossl  DATABASE  USER  CIDR-ADDRESS  METHOD  [OPTION]
#
# (The uppercase items must be replaced by actual values.)
#
# The first field is the connection type: "local" is a Unix-domain socket,
# "host" is either a plain or SSL-encrypted TCP/IP socket, "hostssl" is an
# SSL-encrypted TCP/IP socket, and "hostnossl" is a plain TCP/IP socket.
#
# DATABASE can be "all", "sameuser", "samerole", a database name, or
# a comma-separated list thereof.
#
# USER can be "all", a user name, a group name prefixed with "+", or
# a comma-separated list thereof.  In both the DATABASE and USER fields
# you can also write a file name prefixed with "@" to include names from
# a separate file.
#
# CIDR-ADDRESS specifies the set of hosts the record matches.
# It is made up of an IP address and a CIDR mask that is an integer
# (between 0 and 32 (IPv4) or 128 (IPv6) inclusive) that specifies
# the number of significant bits in the mask.  Alternatively, you can write
# an IP address and netmask in separate columns to specify the set of hosts.
#
# METHOD can be "trust", "reject", "md5", "crypt", "password",
# "krb5", "ident", "pam" or "ldap".  Note that "password" sends passwords
# in clear text; "md5" is preferred since it sends encrypted passwords.
#
# OPTION is the ident map or the name of the PAM service, depending on METHOD.
#
# Database and user names containing spaces, commas, quotes and other special # characters must be quoted. Quoting one of the keywords "all", "sameuser" or
# "samerole" makes the name lose its special character, and just match a
# database or username with that name.
#
# This file is read on server startup and when the postmaster receives
# a SIGHUP signal.  If you edit the file on a running system, you have
# to SIGHUP the postmaster for the changes to take effect.  You can use
# "pg_ctl reload" to do that.

# Put your actual configuration here
# ----------------------------------
#
# If you want to allow non-local connections, you need to add more
# "host" records. In that case you will also need to make PostgreSQL listen
# on a non-local interface via the listen_addresses configuration parameter,
# or via the -i or -h command line switches.
#

# CAUTION: Configuring the system for local "trust" authentication allows
# any local user to connect as any PostgreSQL user, including the database
# superuser. If you do not trust all your local users, use another
# authentication method.


# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD

# "local" is for Unix domain socket connections only
local   all         all                               trust

# IPv4 local connections:
host    all         all         127.0.0.1/32          trust
host    all         all         128.208.95.6/32       trust   # Swamp's PC
host all all 128.208.96.124/32 trust # swamp's Mac (This DB Server)

# IPv6 local connections:
host    all         all         ::1/128               trust




---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

              http://archives.postgresql.org/

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux