0% found this document useful (0 votes)
67 views13 pages

Setup Replication With Postgres 9.2

The document provides instructions for setting up replication between two PostgreSQL 9.2 databases on CentOS 6. It describes configuring the master database to enable replication, taking a backup of the data, restoring that backup on the slave server, and configuring the slave to connect as a standby and replicate from the master.

Uploaded by

Angel Dobrev
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
67 views13 pages

Setup Replication With Postgres 9.2

The document provides instructions for setting up replication between two PostgreSQL 9.2 databases on CentOS 6. It describes configuring the master database to enable replication, taking a backup of the data, restoring that backup on the slave server, and configuring the slave to connect as a standby and replicate from the master.

Uploaded by

Angel Dobrev
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Setup replication with Postgres 9.2 on CentOS 6/Redhat EL6/Fedora https://opensourcedbms.com/dbms/setup-replication-with-postgres-9-2-o...

vi /var/lib/pgsql/9.2/data/postgresql.conf

wal_level = hot_standby
max_wal_senders = 1
wal_keep_segments = 50

1 of 13 20.04.2020, 20:03
Setup replication with Postgres 9.2 on CentOS 6/Redhat EL6/Fedora https://opensourcedbms.com/dbms/setup-replication-with-postgres-9-2-o...

vi /var/lib/pgsql/9.2/data/pg_hba.conf

2 of 13 20.04.2020, 20:03
Setup replication with Postgres 9.2 on CentOS 6/Redhat EL6/Fedora https://opensourcedbms.com/dbms/setup-replication-with-postgres-9-2-o...

host     replication     postgres       192.168.1.131/32     trust

service postgresql‐9.2 restart

su ‐ postgres
psql ‐c "SELECT pg_start_backup('replbackup');"
tar cfP /tmp/db_file_backup.tar /var/lib/pgsql/9.2/data
psql ‐c "SELECT pg_stop_backup();"

scp /tmp/db_file_backup.tar root@opensourcedbms_pg_slave:/tmp/

3 of 13 20.04.2020, 20:03
Setup replication with Postgres 9.2 on CentOS 6/Redhat EL6/Fedora https://opensourcedbms.com/dbms/setup-replication-with-postgres-9-2-o...

service postgresql‐9.2 stop

mv /var/lib/pgsql/9.2/data/ /var/lib/pgsql/9.2/data.old

tar xvfP /tmp/db_file_backup.tar

rm ‐f /var/lib/pgsql/9.2/data/postmaster.pid

4 of 13 20.04.2020, 20:03
Setup replication with Postgres 9.2 on CentOS 6/Redhat EL6/Fedora https://opensourcedbms.com/dbms/setup-replication-with-postgres-9-2-o...

vi /var/lib/pgsql/9.2/data/postgresql.conf

hot_standby = on

cp /usr/pgsql‐9.2/share/recovery.conf.sample /var/lib/pgsql/9.2/data/recovery.conf

5 of 13 20.04.2020, 20:03
Setup replication with Postgres 9.2 on CentOS 6/Redhat EL6/Fedora https://opensourcedbms.com/dbms/setup-replication-with-postgres-9-2-o...

vi /var/lib/pgsql/9.2/data/recovery.conf

standby_mode = on
primary_conninfo = 'host=opensourcedbms_pg_master port=5432'

chown postgres.postgres /var/lib/pgsql/9.2/data/recovery.conf

service postgresql‐9.2 start

6 of 13 20.04.2020, 20:03
Setup replication with Postgres 9.2 on CentOS 6/Redhat EL6/Fedora https://opensourcedbms.com/dbms/setup-replication-with-postgres-9-2-o...

7 of 13 20.04.2020, 20:03
Setup replication with Postgres 9.2 on CentOS 6/Redhat EL6/Fedora https://opensourcedbms.com/dbms/setup-replication-with-postgres-9-2-o...

8 of 13 20.04.2020, 20:03
Setup replication with Postgres 9.2 on CentOS 6/Redhat EL6/Fedora https://opensourcedbms.com/dbms/setup-replication-with-postgres-9-2-o...

9 of 13 20.04.2020, 20:03
Setup replication with Postgres 9.2 on CentOS 6/Redhat EL6/Fedora https://opensourcedbms.com/dbms/setup-replication-with-postgres-9-2-o...

10 of 13 20.04.2020, 20:03
Setup replication with Postgres 9.2 on CentOS 6/Redhat EL6/Fedora https://opensourcedbms.com/dbms/setup-replication-with-postgres-9-2-o...

11 of 13 20.04.2020, 20:03
Setup replication with Postgres 9.2 on CentOS 6/Redhat EL6/Fedora https://opensourcedbms.com/dbms/setup-replication-with-postgres-9-2-o...

12 of 13 20.04.2020, 20:03
Setup replication with Postgres 9.2 on CentOS 6/Redhat EL6/Fedora https://opensourcedbms.com/dbms/setup-replication-with-postgres-9-2-o...

13 of 13 20.04.2020, 20:03

You might also like