10 Appendix A - Configuring Streaming Replication
In the example that follows, we will use a .pgpass file to enable md5 authentication for the replication user – this may or may not be the safest authentication method for your environment. For more information about the supported authentication options, please see the PostgreSQL core documentation at:
Modify the postgresql.conf file (located in the data directory, under your Postgres installation), adding the following replication parameter and values to the end of the file:
Use the sudo su – command to assume the identity of the enterprisedb database superuser:
At the psql command line, create a user with the replication attribute:
With your choice of editor, create a .pgpass file in the home directory of the enterprisedb user. The .pgpass file holds the password of the replication user in plain-text form; if you are using a .pgpass file, you should ensure that only trusted users have access to the .pgpass file:
After deleting the existing data directory, move into the bin directory and use the pg_basebackup utility to copy the data directory of the Master node to the Standby:
cd /opt/edb/as9.6/bin
./pg_basebackup –R –D /opt/edb/as9.6/data
--host=146.148.46.44 –-port=5444
--username=edbrepuser --password
The call to pg_basebackup specifies the IP address of the Master node and the name of the replication user created on the Master node. For more information about the options available with the pg_basebackup utility, see the PostgreSQL core documentation at:
When prompted by pg_basebackup, provide the password associated with the replication user.
After copying the data directory, change ownership of the directory to the database superuser (enterprisedb):
Please note: the primary_conninfo parameter specifies connection information for the replication user on the master node of the replication scenario.
Modify the postgresql.conf file (located in data directory, under the Postgres installation), specifying the following values at the end of the file:
10 Appendix A - Configuring Streaming Replication