Re: what to do after a failover

Michael Paquier <[email protected]> Thu, 9 Jan 2020 13:31:39 +0900
Newsgroups gmane.comp.db.postgresql.general
Message-ID <[email protected]>
--IA03tywDYuoVKXrw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Wed, Jan 08, 2020 at 11:06:28PM -0500, Rita wrote:
> I run a master and standby setup with Postgresql 11. The systems are
> identical from a hardware and software setup.  If the master goes down I
> can do a pg_ctl promote on the standby and point my applications to use the
> standby (new master).
>
> Once the original master is online, when is an appropriate time to fail
> back over? And are there any other things besides promote after the
> failover is done?

Make sure that you still have an HA configuration able to handle
multiple degrees of failures with always standbys available after a
promotion.

The options available to rebuild your HA configuration after a
failover depend on the version of PostgreSQL you are using.  After a
failover the most simple solution would be to always recreate a new
standby from a base backup taken from the freshly-promoted primary,
though it can be costly depending on your instance.  You could also
use pg_rewind (available in core since 9.5) to recycle the previous
primary and reuse it as a standby of the new promoted custer.  Note
that there are community-based solutions for such things, like
pg_auto_failover or pacemaker-based stuff just to name two.  These
rely on more complex architectures, where a third node is present to
monitor the others (any sane HA infra ought to do at least that to be
honest).
--
Michael

--IA03tywDYuoVKXrw
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAl4WrKsACgkQnvQgOdby
QH3iXw//YjamTvDIGL8qMFQvqHGcqbWcyigVRkZBhVnqS8vwxRt07dGb5bE64vhm
WbVe5YwHlYR1MLxe9EKEZQ5akUY78pec5W8Tk6IHh9SuGxvrzUXARuTx3mkeSJKt
XvvP8urof0GIFJARYs5WJ+QttuktmGHaDZftIcIhQ4E31d6/UO0pW1lJwK4r89Yk
oCxeklFXvFRZjSJvSmG63+38osXyQOgbggSvfT/cgAhOe2ghTvsuwTE5RGcz35P/
l7k3Fi0BWYZJkwwQgFpvSBGRn0rP/ro7YpLYEN+nYFzzFxhGY3z51jlNkFzzYKX6
RCEHWz2iCxQvPqslLhNgr0w7ESKNYGJLzKT24GfSo4rqZkWN7ZXSmw7Aw9dJlFE1
OccCw4MFuK15fckGEVpYCyMXt59QWezyn/+FJShKuugdKV76X8h2OluZepDgd08g
L+2PtfwLcpDWw8BB+pH50UWfqp+li7BaEEanHK32rG6D9wRmjOHcVoY4qtmDmNEL
dV8h8IW7IeEcaXxvRY8YE/18EJotfu90mAENZyYFPOhZTFPianajgOFz7zYLH6ED
wOeHLCqwY+yKW/OTXS06d6LsTqbmQAS93dScRhISixqa/zfVKEEstAL8knbcBH1+
4cLMI1l8btsU9sCOXcYa9cEkcdLdvJ64KLxNdfU961qUzyTN7XY=
=cimp
-----END PGP SIGNATURE-----

--IA03tywDYuoVKXrw--