How it works...
Using trust authentication is not generally a recommended practice. It is one thing to copy the database without a password once, but quite another to leave a long-term security hole for all database replicas. This means it is time to ensure that the rep_user user has a password. We also need to change pg_hba.conf to reflect the fact that we want to use regular md5 authentication instead of trust. Once we reload the configuration files on the primary server, we move on to the streaming replica.
To get into the practice of using .pgpass files, we create one on the replica server for the rep_user user. The line we created in this file will send our desired password when the sections match; in this case, if we connect to 10.0.30.1 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access