Re: Cannot Start Postgres After System Boot

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Cannot Start Postgres After System Boot
Дата
Msg-id 11894.1287633057@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Cannot Start Postgres After System Boot  (Rich Shepard <rshepard@appl-ecosys.com>)
Ответы Re: Cannot Start Postgres After System Boot  (Andrej <andrej.groups@gmail.com>)
Re: Cannot Start Postgres After System Boot  (Rich Shepard <rshepard@appl-ecosys.com>)
Список pgsql-general
Rich Shepard <rshepard@appl-ecosys.com> writes:
>    The entire script is attached. It's only 2588 bytes.

Personally, I'd drop all the machinations with checking the pidfile or
removing old socket files.  The postmaster is fully capable of doing
those things for itself, and is much less likely to do them mistakenly
than this script is.  In particular, I wonder whether the script's
refusal to start if the pidfile already exists accounts for your
report that it fails to auto-restart after a reboot.

IOW, this:

>         else # remove old socket, if it exists and no daemon is running.

>             if [ ! -f $DATADIR/$PIDFILE ]; then
>                 rm -f /tmp/.s.PGSQL.5432
>                 rm -f /tmp/.s.PGSQL.5432.lock
>                 # pg_ctl start -w -l $LOGFILE -D $DATADIR
>                 su postgres -c 'postgres -D /var/lib/pgsql/data &'
>                 exit 0
>             else
>                 echo "PostgreSQL daemon was not properly shut down"
>                 echo "Please remove stale pid file $DATADIR/$PIDFILE"
>                 exit 7
>             fi

>         fi

could be reduced to just:

        else
            su postgres -c 'postgres -D /var/lib/pgsql/data &'
            exit 0
        fi

I'd also strongly recommend making that be "su - postgres -c ..."
rather than the way it is now; it's failing to ensure that the
postmaster is started with the postgres account's login settings.

I'm not sure about your comment that manual start attempts fail with
    LOG:  could not bind IPv4 socket: Address already in use
It's pretty hard to believe that that could occur on a freshly
booted system unless the TCP port was in fact already in use ---
ie, either there *is* a running postmaster, or something else is
using port 5432.

            regards, tom lane

В списке pgsql-general по дате отправления:

Предыдущее
От: Tim Uckun
Дата:
Сообщение: Re: Updates, deletes and inserts are very slow. What can I do make them bearable?
Следующее
От: Tim Uckun
Дата:
Сообщение: Re: Updates, deletes and inserts are very slow. What can I do make them bearable?