Setting up an asynchronous replication
After going through the transaction log related issues, it is time to set up the asynchronous replication. The process itself is pretty simple. However, it is important to gain some overview of the problem.
Obtaining a high-level overview
So, before digging into details, I would like to list the steps necessary to set up a streaming replication slave.
Note
Slaves are always read-only. Writes are not allowed on slaves.
The steps are as follows:
Install PostgreSQL and create a
data
directory in the slave as follows:mkdir /data # for example
chmod 700 /data # to start PostgreSQL
chown postgres.postgres /data # if running as postgres
Edit
postgresql.conf
in the master:Set
wal_level
tohot_standby
Set
max_wal_senders
to a reasonably high numberSet
hot_standby
toon
(for making things easier later on)
Edit
pg_hba.conf
in the master and add replication rules to make sure remote boxes can connect to your server.Restart PostgreSQL on the master...