pitrtools is a Python + Postgresql application that assists in the provisioning of Hot Standby,Warm Standby,Cold Standby,Streaming Replication clusters and multiple standbys (slaves). It supports all Postgresql versions from 8.2+ including 9.2.
Requirements:
Rsync
Python >= 2.6
SSH
Postgresql 8.2+
#rpm-qa|greprsync rsync-3.0.6-9.el6_4.1.x86_64 #python-V Python2.6.6 $pg_config--version Postgresql9.3.4
编译安装:
pg_standby
pg_archivecleanup
[root@masterdb~]#mkdir/opt/pg93/archive [root@masterdb~]#chownpostgres:postgres/opt/pg93/archive/ $cd/opt/pitrtools-1.3/etc/ $cpcmd_archiver.ini.samplecmd_archiver.ini $cpcmd_standby.ini.samplecmd_standby.ini
cmd_standby
Thecmd_standbyscriptisautilitythatallowseasymanagementofalltypesof standbyPostgresqlservers,fromcoldtowarmandstreamingrepliaction. Itcurrentlyhasthefollowingcapabilities: *Easilytakeabasebackup,includingtablespaces *Restorearchives *Automaticallypurgeoldarchives(ifPostgresql>8.3) *Alertbasedonfailures *StopandstartPostgresqlstandby *Failovertothelatestrestorepointandpoint-in-timerecovery Usage: cmd_standby[options]arg1arg2 Options: -h,--helpshowthishelpmessageandexit -Astart|stop,--action=start|stop StartorStopPostgresql -B,--basebackupStart/Stopabasebackup -CFILE,--config=FILE thenameofthestandbyconfigfile -FVALUE,--failover=VALUE Valueisa3digitnumber999 -I,--dbinitUsebefore-B -P,--pingIsmymasteralive? -RTIMESTAMP,--recovertotime=TIMESTAMP Ifyouneedtorestoretoaspecificpointintime -S,--standbyEnterstandbymode
cmd_archiver
cmd_archiverscriptisusedinconjunctionwithPostgresql'snative archivemodefunctionalitytoshipWALsegmentstoconfiguredstandby servertoreplaythem. *Automaticallyshiplogfilestoconfiguredstandbyserver *Enable/disablearchivingwithouttheneedtorestartPostgresql *Alertbasedonfailures Usage: cmd_archiver[options]arg1arg2 Options: -h,--helpShowthishelpmessageandexit -FFILE,--file=FILEArchivefile -CFILE,--config=FILE Thenameofthearchiverconfigfile -f,--flushFlushallremainingarchivestoslave -I,--initInitializemasterenvironment