For this scenario, the server at 192.168.56.10 is the primary PostgreSQL server, and 192.168.56.20 will be the asynchronous replica. Follow these steps to build a PostgreSQL asynchronous replica:
- Give the rep_user user a password with this SQL statement:
ALTER USER rep_user WITH PASSWORD 'newpass';
- On the primary server, modify the pg_hba.conf line and remove any references to the rep_user user. Then, add this line:
host replication rep_user 192.168.56.20/32 md5
- Reload the configuration files on the primary server with the following command as the postgres user:
pg_ctl -D /db/pgdata reload
- On the replica server, create a file named .pgpass in the postgres user's home directory with the following contents: