PROJET AUTOBLOG


Shaarli - Librement Shaarli

Site original : Shaarli - Librement Shaarli

⇐ retour index

Pause and resume hot_standby replication on Postgres database

lundi 26 mars 2018 à 12:09
Vérif de réplication :
sur le master :
select * from pg_stat_replication;
sur le slave :
SELECT                        
CASE
WHEN pg_last_xlog_receive_location() = pg_last_xlog_replay_location() THEN 0
 ELSE EXTRACT (EPOCH FROM now() - pg_last_xact_replay_timestamp())::INTEGER
END
AS replication_lag;
(0 si tout va bien sinon secondes de délai)

ou

select   pid, client_addr, state, sync_state,  
         pg_xlog_location_diff(sent_location, write_location) as write_lag,  
         pg_xlog_location_diff(sent_location, flush_location) as flush_lag,  
         pg_xlog_location_diff(sent_location, replay_location) as replay_lag
from pg_stat_replication ;

To pause, run the following query on the slave server:

select pg_xlog_replay_pause();

To resume, run
select pg_xlog_replay_resume();

à compléter.
Permalink