Beruflich Dokumente
Kultur Dokumente
Below is an example or just an introduction of how to setup a Warm Stand By Server for a
Stand Alone Server on PostgreSQL 8.3 using pg_standby ,
postgres@ashokraj:~> ls
total 8
drwxr-xr-x 3 postgres users 4096 2008-12-29 15:29 basebkp
drwx------ 11 postgres users 4096 2008-12-29 16:29 data
As shown above I am having my stand alone postgres server running at data directory “data”
for which I am going to start a warm standby server on the same machine
1) Edit the postgresql.conf file to activate the archive mode of the server and define
where to archive the transactional logs
postgres@ashokraj:~> vi data/postgresql.conf
archive_mode = on
archive_command = 'cp -i %p /d0/data/archive_backups/%f'
archive_timeout = 300s
postgres@ashokraj:~> psql
Welcome to psql 8.3.4, the PostgreSQL interactive terminal.
[local]:5432:postgres# \l
List of databases
Name | Owner | Encoding
-----------+----------+----------
postgres | postgres | UTF8
template0 | postgres | UTF8
template1 | postgres | UTF8
(3 rows)
postgres@ashokraj:~/data> psql
postgres@ashokraj:~> cd basebkp
postgres@ashokraj:~/basebkp> cp -r /home/postgres/data .
postgres@ashokraj:~/basebkp> l
total 12
drwxr-xr-x 3 postgres users 4096 2008-12-29 15:28 ./
drwxr-xr-x 5 postgres users 4096 2008-12-29 15:21 ../
drwx------ 11 postgres users 4096 2008-12-29 15:28 data/
postgres@ashokraj:~/basebkp> ls
standby
postgres@ashokraj:~/basebkp> vi standby/recovery.conf
postgres@ashokraj:~/basebkp/standby> rm -f postmaster.pid
Stop Stand Alone Server and Use the server as a Live DB server