Wal standbies switchover - Mailing list pgsql-admin

From Dimitri Gritsenko
Subject Wal standbies switchover
Date
Msg-id 79eb93740708020126i5ac550bdw7a42cec1930793e7@mail.gmail.com
Whole thread Raw
Responses Re: Wal standbies switchover  (Decibel! <decibel@decibel.org>)
List pgsql-admin
Goal - having 1 master and 2 standbies - make switchover in the way , that except minimal downtime - there was always 1 running master and 2 warm standbies.

Lets say i have 3 hosts (1,2,3) , 1 master and 2  warm standbies .  ( M1 SB2 SB3)
Each SB gets (Master rsyncs from his side to SB)  archived wal  files from master  and recovers in continues way untill triggered to start as master., also it gets incomplete wals from  pg_xlog dir .
Switchover looks for me  like this.
1. M1  stops , all sync crons  stopped.
2. Do last rsync of  archived wals and pg_xlog  to  SB2 , SB3
3. SB2 triggered to start , it recovers last incomplete wals from pg_xlog and starts (becomes M2), and starts cron rsync to SB3
4. SB3 does nothing , it continues get recover wal archives which now it gets from M2. (Question - is it ok ? It looks like new archived wal files from M2 should be valid without any changes)
5. What happens on host 1 (former master) is a question. It needs to become a SB1 . Do i need to make large rsync of whole db from M2 (like during SB install) or i can just keep old data and start db in recovery mode , getting new wal files?


There is a difference between SB2 and new SB1. SB2 had data_dir - corresponding to last recovered ARCHIVED file , and SB1 - to last INCOMPLETE WAL files , so its not the same.

So , 2 questions on points 4 and 5.

Any comments?


pgsql-admin by date:

Previous
From: David Bear
Date:
Subject: incrementals with pg-dump
Next
From: Ralph Smith
Date:
Subject: pg_catalog.pg_roles DESTROYED?