...
Support Postgresql version
v10 - v14
Both servers should be running the same version.
Network connectivity
The servers must need to be on the same network and have proper consistent network connectivity.
Primary server should have proper Ensure that the primary server has the correct pg_hba.conf settingsettings.
CSD for streaming Mode
Drawio | ||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Trigger CSD in streaming mode
Create Replication Slot on Primary
Run the following SQL query on the primary server to create a physical replication slot named SLOT_NAME
Code Block SELECT * FROM pg_create_physical_replication_slot(SLOT_NAME, false, false) WHERE NOT EXISTS (SELECT * FROM pg_replication_slots WHERE slot_name = SLOT_NAME)
On Primary MP find and Tar the postgresql config files, IncludingTar PostgreSQL Config Files on Primary:
postgres.conf
pg_ident.conf
pg_hba.conf
On Standby MP receive tar ball of postgresql Transfer Config Files to Standby
Transfer the tarball containing PostgreSQL config files from
the primary server to the standby server
Data directory setup: Directory Setup Using pg_basebackup to initialize
Initiate a streaming backup from Standby to Primary to retrieve all files in data directory from Primary with the Replication Slot created the standby server to the primary server. This process retrieves all files from the primary server's data directory and includes the previously established replication slot on step 2Code Block /opt/rh/rh-postgresql13/root/usr/bin/pg_basebackup -D /var/lib/pgsql/data/13/main -F plain -X stream -S dbvisit_2 -R --progress --verbose --checkpoint=fast -d postgres://postgres@postgresqlcentos1:5432
Config directory setup: Directory Setup
Extract files from tar ball recieved on step 4 and put place them into in the target config configuration directory on the standby server
Configure the PostgreSQL configuration in streaming mode according to instance on the standby server for streaming replication based on the CSD parameter and streaming the replication slot .created earlier
If the OS operating system is windowsWindows, register windows a Windows service for the PostgreSQL cluster
Restart Standby Server
After setting up data director and config directory, restart standby server
Applying Configuration Changes
Applying the latest changes on configuration coming CSD and persisting configuration data on Control Center
CSD for archive Mode
Drawio | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Trigger CSD in archive mode
Create Base Backup Files
Generate the essential base backup files using the following command:
Code Block /opt/rh/rh-postgresql13/root/usr/bin/pg_basebackup -D tempBackupDir -F tar -X stream -R --progress --verbose
The aforementioned command will generate the subsequent files, which are to be transferred to the Standby in order to facilitate the cluster restoration process.
base.tar: postgresql base files, including setting and etc
pg_wal.tar: wal data files for standby to restore
tblspc_xxxxx.tar: customized table space files
backup_manifest: backup meta data, is used for
pg_verifybackup
to verify the backup
On Primary MP find and Tar the postgresql config files, Includingfollowing PostgreSQL configuration files on the primary server
postgres.conf
pg_ident.conf
pg_hba.conf
On Standby MP receive all files generated from Primary server Transfer Backup Files from Primary to Standby, which are generated on step 3 and step 2.b
Data directory setup : Extract
On the Standby, receive and extract all files generated from Step 2.b and
Step 3. Place these files in the designated data folder, previously allocated before initiating CSD.
Config directory setup:
Extract the files from tar ball recieved on step the tarball received in Step 4 and put place them into the target config configuration directory on the standby server.
Configure the PostgreSQL configuration in archive mode according to as per the CSD parameter
If the OS is windows, register windows service for the cluster
After setting up configuring the data director and config directorydirectories, restart the standby PostgreSQL server
Apply Configuration Changes from CSD
Applying the latest changes on configuration coming CSD and persisting configuration data on Control Center
CSD for Log shipping Mode
Drawio | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...
Trigger CSD in archive mode
Create Replication Slot on Primary
Run the following SQL query on the primary server to create a physical replication slot named SLOT_NAME
Code Block SELECT * FROM pg_create_physical_replication_slot(SLOT_NAME, false, false) WHERE NOT EXISTS (SELECT * FROM pg_replication_slots WHERE slot_name = SLOT_NAME)
Create Base Backup Files
Generate the essential base backup files using the following command
Code Block /opt/rh/rh-postgresql13/root/usr/bin/pg_basebackup -D tempBackupDir -F tar -X stream -R --progress --verbose -S slot_name
The aforementioned command will generate the subsequent files, which are to be transferred to the Standby in order to facilitate the cluster restoration process.
base.tar: postgresql base files, including setting and etc
pg_wal.tar: wal data files for standby to restore
tblspc_xxxxx.tar: customized table space files
backup_manifest: backup meta data, is used for
pg_verifybackup
to verify the backup
Note: Different archive mode base backup, backups and log shipping backup backups also brings include the replication_slot to within the base backup files and transfer it to the standby afterwards.
On Primary MP find and Tar the postgresql config files, Includingfollowing PostgreSQL configuration files on the primary server
postgres.conf
pg_ident.conf
pg_hba.conf
On Standby MP receive all files generated from Primary server Transfer Backup Files from Primary to Standby, which are generated on step 3 and step 2.b
Data directory setup : Extract
On the Standby, receive and extract all files generated from Step 2.b and
Step 3. Place these files in the designated data folder, previously allocated before initiating CSD.
Config directory setup:
Extract the files from tar ball recieved on step the tarball received in Step 4 and put place them into the target config configuration directory on the standby server.
Configure the PostgreSQL configuration in log shipping mode according to archive mode as per the CSD parameter and replication slot.
If the OS is windows, register windows service for the cluster
After setting up configuring the data director and config directorydirectories, restart the standby PostgreSQL server
Apply Configuration Changes from CSD
Applying the latest changes on configuration coming CSD and persisting configuration data on Control Center