Обсуждение: turn pitr 'on' on PostgreSQL 8.2 - pg_standby
Dear all,
I have been playing with PITR on version 8.3 so far, but I need to get it working on version 8.2.
What is the difference between:
archive_command = on (is this command for 8.2?)
archive_mode = on (This one is for 8.3!)
I need to enable ‘archive_mode = on’, restart postgres, before I can do the base backup, is that correct?
In order to bring the standby online I need a trigger file, something like:
can I call the trigger file whatever I want? for example; ‘/var/log/postgres/postgresql.8.2.trigger’
Postgres 8.2 config
Master:
Postgresql.conf
archive_command = on
archive_command = 'cp -i %p /mnt/pitr/%f </dev/null'
archive_timeout = 60
# mkdir /mnt/pitr
# chown postgres: /mnt/pitr (this will be an NFS mount point)
# mount –t nfs fnsserver01:/pitr /mnt/pitr
# service postgresql restart
# su – postgres
# psql –U postgres
SELECT pg_start_backup('pitr_backup');
\q
# Tar –cvf pg_data.tar /usr/loca/pgsql/data
# Psql –U postgres
SELECT pg_stop_backup();
# cp pg_data.tar /mnt/pitr
Postgres 8.2 config
StandBy:
# Compile pg_standy from the contrib/ folder
# cd /usr/local/pgsql
# rm –rf data/
# tar –xvf /mnt/pitr/pg_data.tar
# chown –R postgres: data
# cd data/
# cd pg_xlog/ - delete the content
# cd ../data
# touch recovery.conf
restore_command = 'pg_standby -l -d -s 2 -t /var/log/postgres/ postgresql.8.2.trigger /mnt/pitr/ %f %p %r 2>>pitr_standby.log'
Postgresql.conf
#archive_command = off - disabled and commented out
#archive_command = '' – disabled and command removed
# archive_timeout = 60 – disabled
Is this correct, am I missing something or anything here isn’t correct?
If anyone could give me some light with this it would be very much appreciated.
Thank you very much
Renato
Systems Administrator
e-mail: renato.oliveira@grant.co.uk
Company registered in England, registration number 658133
Registered office address:
29 Station Road,
Shepreth,
CAMBS SG8 6GB
UK
P Please consider the environment before printing this email
Renato Oliveira wrote: > > What is the difference between: > > archive_command = on (is this command for 8.2?) > > |archive_mode = on (This one is for 8.3!)| > 8.2 doesn't have a archive_mode setting, that was added in 8.3. With 8.2, you set the archive_command in the same way as you do in 8.3. There just isn't a dedicated parameters to toggle archiving on and off that's separate from changing the command used. > |In order to bring the standby online I need a trigger file, something > like:| > > |can I call the trigger file whatever I want? for example; > ‘/var/log/postgres/postgresql.8.2.trigger’| > It doesn't matter where the trigger file is at so long as you use it correctly. The other thing to be careful of, that you already noted, is that since 8.2 doesn't ship with pg_standby, you need to grab your version of that. You should try to use the one that ships with 8.4. Also, it's not going to support the "%r" syntax in the restore_command, so you need to set the "-k" setting to a moderately high value for 8.2 servers. It's difficult to say exactly how high that must be for any possible workload. Something like "-k 256" is a reasonable starter setting that will save the last 4GB of archive logs shipped over on the standby, which is high enough to make deleting one of them prematurely unlikely (but not impossible for the right difficult workload). -- Greg Smith 2ndQuadrant US Baltimore, MD PostgreSQL Training, Services and Support greg@2ndQuadrant.com www.2ndQuadrant.us