marketplace
replicator
passw0rd
192.168.0.31
, 192.168.0.32
postgresql.conf
postgresql.conf
file is the main configuration file for PostgreSQL. It contains all the server settings that control the behavior and performance of your PostgreSQL instance.
Ensure that your postgresql.conf
has the following settings applied:
listen_addresses
specifies the IP addresses on which PostgreSQL listens for connections. By default, PostgreSQL only listens on localhost
. To allow other servers (like your standby servers) to connect for replication, you need to include their IP addresses.max_wal_senders
determines the maximum number of concurrent connections that can send WAL (Write-Ahead Log) data.pg_search
on the primary server, make sure to add it to shared_preload_libraries
if your Postgres version is less than 17. If you are installing it only on the standby server as a search replica,
you should skip this step.
pg_hba.conf
pg_hba.conf
file (PostgreSQL Host-Based Authentication file) controls client authentication, defining who can connect to the PostgreSQL server, how they can connect, and from where. It ensures that only authorized users and systems can access the database.
We need to allow the replication user to connect from the standby servers’ IP addresses. Add the following lines to allow replication from the local network and localhost. This configuration ensures that the replication user can connect from the specified IP range.
--pwprompt
prompts you to enter a password for the new user. In this tutorial, we will be setting the password to passw0rd
.
--replication
grants the replication privilege to the new user, allowing it to handle replication tasks.
pg_search
on the primary, you can build a BM25 index over the table.
pg_basebackup
on your standby server to create a physical byte-for-byte replica of your primary cluster. The --pgdata
directory specifies the where the standby cluster will be created. The directory must exist, and must be empty.
pg_basebackup
, you can set up a subscription to propagate changes on the primary server to the standby.