Exploring a logical replication setup and new logical replication features on PostgreSQL 16
Let’s now explore how to perform logical replication. In this section, we will prepare the environment we need to be able to perform our logical replication.
Logical replication environment settings
Suppose we have two machines, which we will call pg_pub
and pg_sub
. We must remember to set our internal DNS, or the /etc hosts
file, so that pg_pub
can reach pg_sub
; for example, for the pg_pub
server, the primary server will have an IP of 192.168.144.3
, and for the pg_sub
server, the replica server will have an IP of 192.168.144.2
. If you use the chapter18
container, you can execute:
chapter_18$ bash run-pg-docker.sh chapter18_logical_clear
Once you are inside the first container, you can open another bash terminal and execute:
chapter_18$ bash run-pg-docker_replica.sh chapter18_logical_clear
Now, let’s check whether there is a connection between the two...