Re: Shutting down server from a backend process, e.g. walrceiver

Поиск
Список
Период
Сортировка
От Fujii Masao
Тема Re: Shutting down server from a backend process, e.g. walrceiver
Дата
Msg-id AANLkTimvrACapfEgmdP1RFdmvwGzOeGqKMPgtJvr4e8_@mail.gmail.com
обсуждение исходный текст
Ответ на Shutting down server from a backend process, e.g. walrceiver  (fazool mein <fazoolmein@gmail.com>)
Ответы Re: Shutting down server from a backend process, e.g. walrceiver  (fazool mein <fazoolmein@gmail.com>)
Список pgsql-hackers
On Tue, Sep 21, 2010 at 9:48 AM, fazool mein <fazoolmein@gmail.com> wrote:
> Hi,
>
> I want to shut down the server under certain conditions that can be checked
> inside a backend process. For instance, while running symmetric replication,
> if the primary dies, I want the the walreceiver to detect that and shutdown
> the standby. The reason for shutdown is that I want to execute some other
> stuff before I start the standby as a primary. Creating a trigger file
> doesn't help as it converts the standby into primary at run time.
>
> Using proc_exit() inside walreceiver only terminates the walreceiver
> process, which postgres starts again. The other way I see is using
> ereport(PANIC, ...). Is there some other way to shutdown the main server
> from within a backend process?

Are you going to change the source code? If yes, you might be able to
do that by making walreceiver send the shutdown signal to postmaster.

If no, I think that a straightforward approach is to use a clusterware
like pacemaker. That is, you need to make a clusterware periodically
check the master and cause the standby to end when detecting the crash
of the master.

Regards,

-- 
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center


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

Предыдущее
От: David Fetter
Дата:
Сообщение: Re: Path question
Следующее
От: Fujii Masao
Дата:
Сообщение: Re: libpq changes for synchronous replication