Thread: How to recovery failed master after failover

How to recovery failed master after failover

From
snowbird
Date:
Hi,

   I am evaluating the HA solution of PostgreSQL 9.3.
        1. Pacemaker resource agent for PostgreSQL + PostgreSQL sync stream
replication
        2. PG-Pool + PostgreSQL sync stream replication
   According to my understanding, above two solution must be done same
things to recovery failed master as new slave after fail over: copy the
database from new master.  Is it necessary operation to recovery failed
master? Does it protect the data consistent after fail over?
   If copy operation is necessary, recovery time very depend on database
size. For example, our database size is 10G, we have to wait for a few
minutes for copying new master data by network.

BRs,
Leo



--
View this message in context:
http://postgresql.1045698.n5.nabble.com/How-to-recovery-failed-master-after-failover-tp5794524.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


Re: How to recovery failed master after failover

From
Tatsuo Ishii
Date:
>    I am evaluating the HA solution of PostgreSQL 9.3.
>         1. Pacemaker resource agent for PostgreSQL + PostgreSQL sync stream
> replication
>         2. PG-Pool + PostgreSQL sync stream replication
>    According to my understanding, above two solution must be done same
> things to recovery failed master as new slave after fail over: copy the
> database from new master.  Is it necessary operation to recovery failed
> master? Does it protect the data consistent after fail over?
>    If copy operation is necessary, recovery time very depend on database
> size. For example, our database size is 10G, we have to wait for a few
> minutes for copying new master data by network.

I'm not in position to speak about the Pacemaker resource agent. I
only speak about pgpool-II.

The reason why the failed master need to be recovered is,
availability, not consistency. If you do not do that, you only have
the new master at that point. If it goes down, it's the end of your
system.

About the 10G database recovery. you do *not* need to wait until all
the data copied. You can issue not only read queries but write queries
to the system. Any modifications to the database while copying data
has been recorded to WAL (or archive log) and will be sent to new
slave afterward. The only concern is the additional load to copy
data. You could overcome it by affording more higher spec hardwares.

Best regards,
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese: http://www.sraoss.co.jp


Re: How to recovery failed master after failover

From
leo
Date:
I wonder how to quickly recovery failed master? If I directly startup the
failed master as slave ( assign proper parameter), is there any problem? For
example, I don't do any copy operation in script of
recovery_1st_stage_command and recovery_2st_stage_command.

According to this document:
https://wiki.postgresql.org/wiki/Synchronous_Transfer, can I only copy AWL
for recovering failed master?



--
View this message in context:
http://postgresql.1045698.n5.nabble.com/How-to-recovery-failed-master-after-failover-tp5794524p5794547.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


Re: How to recovery failed master after failover

From
Michael Paquier
Date:
On Tue, Mar 4, 2014 at 6:26 PM, leo <dazhoufei@gmail.com> wrote:
> I wonder how to quickly recovery failed master? If I directly startup the
> failed master as slave ( assign proper parameter), is there any problem?
Yep, if the master has got ahead of the slave in term of WAL replay
where WAL forked after the slave promotion, you won't be able to
reconnect an old master as a slave. In this case, what you need to do,
is either to rewind the old master using for example pg_rewind (which
is not a tool part of Postgres core) or create a new node from scratch
with a base backup and some archives, and then reconnect it. Depending
on the size of data in server, this could take some time because of
network latency and if you create a new base backup, especially if
both nodes are on different (distant?) servers.
--
Michael


Re: How to recovery failed master after failover

From
leo
Date:
I find a solution to short the recover time by configure parameter
Synchronous Transfer. Refer to :
https://wiki.postgresql.org/wiki/Synchronous_Transfer.
   But I don't which postgreSQL will enable this parameter, I install
9.3.3-1 on redhat, but I don't find this parameter in postgresql.conf.
   Is there anyone use this parameter?

Leo



--
View this message in context:
http://postgresql.1045698.n5.nabble.com/How-to-recovery-failed-master-after-failover-tp5794524p5794720.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


Re: How to recovery failed master after failover

From
Venkata Balaji Nagothi
Date:


On Wed, Mar 5, 2014 at 2:14 PM, leo <dazhoufei@gmail.com> wrote:
   I find a solution to short the recover time by configure parameter
Synchronous Transfer. Refer to :
https://wiki.postgresql.org/wiki/Synchronous_Transfer.
   But I don't which postgreSQL will enable this parameter, I install
9.3.3-1 on redhat, but I don't find this parameter in postgresql.conf.
   Is there anyone use this parameter?

Not sure if you have been through the below links. They might be helpful for you.