[pgpool-hackers: 897] Idea for 3.5: switch over script
Tatsuo Ishii
ishii at postgresql.org
Thu Apr 30 13:55:16 JST 2015
Now that PostgreSQL 9.5 has pg_rewind in core, I would like to propose
adding new directive "switchver_script", whose function is almost same
as failover_script except that the former is called only when switch
over is requested, which will be triggered by new command
"pcp_switchover".
Switchover_script will execute pg_rewind, thus has an advantage over
pg_basebackup or rsync (or whatever) used to recover new standby, in
terms of recovery duration because pg_rewinrd does not require copying
whole database cluster. The reason why pg_rewind cannot be used for
failover_script is, pg_rewind will not work for the primary server
crash case. That's the reason why we need to have a separate script
for the switch over case.
pcp_switchover works like this:
1) pcp_switchover --mode prepare --node node_number
Prepare switchover. From now on, pgpool-II will call
switchover_script rather than failover_script when a node goes
down. "--node" specifies a node to be promoted after switchover. If
this parameter is not specified, pgpool-II will automatically
select a standby node which is the first live standby node in
pgpool.conf.
2) After #1 is completed, the primary node is shutdown by an
operator. This triggers switchover and pgpool-II executes the
switchover_script. After switchover the node specified by --node
option will be promoted.
3) pcp_switchover --mode stop
If the operator decides to cancel the switchover work between
"pcp_switchover --mode prepare" and shutting down the primary for
some reason, this commands should be executed. This will clear
"switchover mode" and any event after this will trigger
failover_script as usual.
Comments and suggesions are welcome.
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp
More information about the pgpool-hackers
mailing list