Search Postgresql Archives

How to failover from Primary to Standby and Set the old Primary as a new Standby

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I use PG 9.2.4 with streaming replication.  What will be the manual procedure to failover from Primary to Standby and Set the old Primary as a new standby?


step 1:  standby's recovery.conf :
# Specifies a trigger file whose presence should cause streaming replication to end (i.e., failover).
trigger_file = '/var/lib/postgresql/main/trigger'

step 2:  To trigger a smart failover, create a trigger file containing the word smart, or just create it and leave it empty. (e.g. 
vi  /var/lib/postgresql/main/trigger
smart

step 3: wait until the failover is completed, the server is brought up after applying all WAL files available in the archive. 
How to check if the failover is completed and the new Primary is ready?

step 4: if the failover is done
Do I need to edit the new primary's postgresql.conf and restart postgresql? e.g. comment out the hot_standy = on 

step 5: how to quickly set the old primary as a new standby?
	SELECT pg_start_backup('replbackup');
	tar cfP /home/postgres/pg_backup.tar $PG_DATA
	SELECT pg_stop_backup();
	send  /home/postgres/pg_backup.tar to the old primary
	unzip the tar file to $PG_DATA & delete postmaster.pid
	create the recovery.conf 
	edit the postgresql.conf to enable "hot_standby = on"
	start postgresql 
if the PG_DATA has 600GB data, is there a quicker way to set the old primary as a new standby?


regards 

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux