postgres hot-standby questions.

Поиск
Список
Период
Сортировка
От Graeme B. Bell
Тема postgres hot-standby questions.
Дата
Msg-id 848F3721-4A21-4260-9640-8F698E3EE376@skogoglandskap.no
обсуждение исходный текст
Ответы Re: postgres hot-standby questions.
Re: postgres hot-standby questions.
Re: postgres hot-standby questions.
Список 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
logicaldatabases & 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
guessis: no) 
- Is the primary shutdown delayed until it has received notice from the standby that all WAL has been applied?    ( my
guessis: no) 
- Can the primary generate any new WAL (e.g. checkpoint) or logical data changes during the shutdown process that might
notbe 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
theuser 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)?


2. Let's assume for the moment I have some crazy reason to prefer to avoid rsync where possible, such as its historical
weirdbehaviour on HFS+ filesystems or its present unreliable heuristic for syncing hard-links or its default behaviour
ofnot 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'sassume here than 99% of maintenance takes less than an hour, and that we're keeping rsync as a fallback for the
worstcase. 

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)


Graeme Bell




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

Предыдущее
От: Paul Dunkler
Дата:
Сообщение: Re: pg_xlog-files not deleted on a standby after accidental server crash
Следующее
От: Scott Ribe
Дата:
Сообщение: Re: postgres hot-standby questions.