Re: Disable Streaming Replication without restarting either master or slave

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Samba <saasira(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Disable Streaming Replication without restarting either master or slave
Date: 2012-05-29 17:10:34
Message-ID: CAHGQGwG0V+Q5aH0A5kdGpdBYTxzH=WHqY3xUVoZ-mDfNwD1WwA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, May 29, 2012 at 7:18 PM, Samba <saasira(at)gmail(dot)com> wrote:
> Hi,
>
>
> Is it possible stop/disable streaming replication without stopping or
> restarting either master or slave servers?
>
> Since stopping or restarting the postgres servers would involve complete
> invalidation of the connection pool [Java/JEE app server pool] that may take
> a few minutes before the application becomes usable, it would be great if
> there is a way we can disable replication [for maintenance reasons like
> applying patches or upgrades, etc].

There is no clean way to disable streaming replication. But you can do that
by the following steps:

1. change pg_hba.conf in the master so that the master does not accept new
replication connection
2. reload pg_hba.conf in the master
3. send SIGTERM signal to currently-running walsender process, e.g., by
"select pg_terminate_backend(pid) from pg_stat_replication".

Then replication connection will be terminated. The standby tries reconnecting
to the master, but which will continue failing until you'll change pg_hba.conf
again.

Regards,

--
Fujii Masao

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Fujii Masao 2012-05-29 17:15:12 Re: Disable Streaming Replication without restarting either master or slave
Previous Message Merlin Moncure 2012-05-29 15:20:00 Re: Export and import from one postgres server to another