Database Reference
In-Depth Information
> mkdir
C:\postgis_cookbook\db\standby\archive
2. Initialize the database clusters with
initdb
as follows:
> cd C:\postgis_cookbook\db
> initdb --encoding=utf8
--locale=en_US.utf8 -D primary
> initdb --encoding=utf8
--locale=en_US.utf8 -D standby
3. Edit the
pg_hba.conf
authentication file of the primary cluster by running
the following command:
> notepad primary\pg_hba.conf
4. If you're running PostgreSQL 9.0, add the following text to the end of
pg_hba.conf
:
local replication
postgres trust
host replication postgres
127.0.0.1/32 trust
host replication postgres
::1/128 trust
5. For PostgreSQL 9.1 or a higher version, the script in the previous step is
already provided in
pg_hba.conf
. You just need to remove the comment
character (
#
) from the beginning of each matching line.
6. Edit the primary cluster's
postgresql.conf
configuration file to set the
streaming replication parameters. Search for each parameter and replace
the assigned value to the following:
port = 5433
wal_level = hot_standby
max_wal_senders = 5
wal_keep_segments = 32
archive_mode = on
archive_command = 'copy "%p"