Re: postgres hot-standby questions.

From: "Gilberto Castillo" <gilberto(dot)castillo(at)etecsa(dot)cu>
To: "Graeme B(dot) Bell" <grb(at)skogoglandskap(dot)no>
Cc: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>, "Simon Riggs" <simon(at)2ndquadrant(dot)com>
Subject: Re: postgres hot-standby questions.
Date: 2015-03-26 16:16:14
Message-ID: 45346.192.168.207.54.1427386574.squirrel@webmail.etecsa.cu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

>
> Hello everyone,
>
> Two questions, grateful for any feedback anyone can share. They relate to
> switchover between master and hot-standby.
>
>
> 1. What exactly is the behaviour of the master/primary during shutdown
> when it has a hot standby?
>
> https://wiki.postgresql.org/wiki/Hot_Standby
> http://www.postgresql.org/docs/current/static/hot-standby.html
>
> If I shut down the master, then afterwards when it is finished, I shut
> down the standby, will they contain identical logical databases & WAL
> records, e.g. assuming possible network failure?
>
> i.e.
> - Is the primary shutdown delayed until it has received notice from the
> standby that all WAL has been received? ( my guess is: no)
> - Is the primary shutdown delayed until it has received notice from the
> standby that all WAL has been applied? ( my guess is: no)
> - Can the primary generate any new WAL (e.g. checkpoint) or logical data
> changes during the shutdown process that might not be sent to the standby?
> (my guess is: no)
>
> For example,
> https://vibhorkumar.wordpress.com/2014/06/30/switchoverswitchback-in-postgresql-9-3/
> "With this patch, the walsender process tries to send all outstanding WAL
> records to the standby in replication when the user shuts down the
> master."
> "tries"?
>
> That page also makes it seem like you have to manually check the WAL
> status. (section 2)
> Is there any way to make the primary's completion of shutdown
> automatically synchronous with completion of WAL on standby(s)?

What you used for you repltación? aplication u other.

>
> 2. Let's assume for the moment I have some crazy reason to prefer to avoid
> rsync where possible, such as its historical weird behaviour on HFS+
> filesystems or its present unreliable heuristic for syncing hard-links or
> its default behaviour of not using checksums. Can a controlled switchover
> (not failover) be built on wal_keep_segments alone?
>
> wal_keep_segments could be set to a fairly high number, maybe 10000
> (160GB) to allow standby catchup even after a day. Let's assume here than
> 99% of maintenance takes less than an hour, and that we're keeping rsync
> as a fallback for the worst case.
>
> e.g. here's the whole switchover process...
>
> shutdown A (Master)
> shutdown B (Standby)
> (A and B should be identical in terms of WAL and logical data at this
> point).
> swap M/S configurations around
> start B (Master)
>
> do some work on A for an hour
> finish work on A
>
> start A (Standby)
> A catches up with B from wal_keep_segments.
>
>
> shutdown B (Master)
> shutdown A (Standby)
> (A and B should be identical in terms of WAL and logical data at this
> point).
> swap M/S configurations around
> start A (Master)
> start B (Standby)
>

Remeber init the slave igual firt moment.

> Graeme Bell
>
>
>
>
> --
> Sent via pgsql-admin mailing list (pgsql-admin(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-admin---
> This message was processed by Kaspersky Mail Gateway 5.6.28/RELEASE
> running at host imx2.etecsa.cu
> Visit our web-site: <http://www.kaspersky.com>, <http://www.viruslist.com>
>

Saludos,
Gilberto Castillo
La Habana, Cuba

Attachment Content-Type Size
unknown_filename text/plain 179 bytes

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Scott Ribe 2015-03-26 16:18:06 Re: postgres hot-standby questions.
Previous Message Scott Ribe 2015-03-26 16:09:08 Re: postgres hot-standby questions.