Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

Set up disaster recovery

Subcommands

streaming Set up PostgreSQL WAL Streaming disaster recovery
archiving Set up PostgreSQL WAL File Archiving disaster recovery

streaming

dbvcli create-standby streaming {-d|--name} CONFIGURATION_NAME [--OPTIONS]

Set up PostgreSQL WAL Streaming disaster recovery

Option

Type

Description

--observer

Y or N

enable observer

--hot-standby

Y or N

enable hot standby, allowing read-only connections to the standby cluster

--standby-conf-dir

string

directory for the standby cluster config files on standby host

--standby-data-dir

string

directory for the standby cluster data files on standby host

--tablespace-dir

key=val

customize directory on standby for tablespaces

--streaming-password

string

password to use for the replication connection to the primary cluster

--streaming-username

string

username to use for the replication connection to the primary cluster

 Example
-bash-4.2$ ./dbvcli -d PG5432 create-standby  streaming
Connecting to the Control Center at centlin72.oraclekiwi.co.nz:4433 ✓

Checking available actions for this configuration ✓

Standby Cluster Location 1/2
Enter the directory on the standby host that will contain the standby cluster
data files. This directory must be empty or nonexistent.

Standby cluster data files directory:

> /u01/PG5432

Standby Cluster Location 2/2
Enter the directory on the standby host that will contain the standby cluster
configuration files. This directory must be empty or nonexistent.

Standby cluster config files directory:

> /u01/PG5432

Hot Standby
Select whether to enable hot standby, allowing read-only connections to the
standby cluster.

Enable hot standby:

(•) Yes
( ) No

Streaming Mode Configuration 1/2
Enter the PostgreSQL username to use for the streaming connection to the source
cluster.
The source cluster must be configured to accept replication connections from the
standby host as this user. Additionally, this user must be granted the
pg_read_all_stats role.

Streaming username:

> repuser

Streaming Mode Configuration 2/2
Enter the password for the streaming connection to the source cluster.

Streaming password:

> *******


Observer
Select whether to enable the Observer. The Observer will watch your
Configuration, and notify you on the Dashboard in case any problems are detected
with your Disaster Recovery Configuration.

Enable Observer:

(•) Yes
( ) No

Confirmation
A base backup of the source cluster will be created and transferred to the
standby host, where it will be used to create the standby cluster. Select Yes to
proceed with creating the standby cluster, or No to cancel the operation.

Create Standby Cluster:

(•) Yes
( ) No

2024-11-01 12:11:02
2024-11-01 12:11:02  Running pre-checks for standby cluster creation
2024-11-01 12:11:02  Preparing to create standby cluster
2024-11-01 12:11:02  Backing up primary cluster
2024-11-01 12:11:02  Backing up config files in directory /u01/PG5432...
2024-11-01 12:11:02  done
2024-11-01 12:11:02  Sending backup to standby
2024-11-01 12:11:02  Sending file 2-base-20241031T231102Z-0_49C68898-0_49C68898-1-1-config.tar to centlin72.oraclekiwi.co.nz...
2024-11-01 12:11:03  done
2024-11-01 12:11:02  Creating standby cluster from backup
2024-11-01 12:11:02  Creating base backup...
2024-11-01 12:11:03  pg_basebackup: initiating base backup, waiting for checkpoint to complete
2024-11-01 12:11:03  pg_basebackup: checkpoint completed
2024-11-01 12:11:03  Base backup started at LSN 0/4A000028
2024-11-01 12:11:03  pg_basebackup: write-ahead log start point: 0/4A000028 on timeline 1
2024-11-01 12:11:03  pg_basebackup: starting background WAL receiver
2024-11-01 12:11:04   33873/940513 kB (3%), 0/1 tablespace (/u01/PG5432/base/16387/16389       )
2024-11-01 12:11:05   82641/940513 kB (8%), 0/1 tablespace (/u01/PG5432/base/16387/16389       )
2024-11-01 12:11:06  131857/940513 kB (14%), 0/1 tablespace (/u01/PG5432/base/16387/16389       )
2024-11-01 12:11:07  182801/940513 kB (19%), 0/1 tablespace (/u01/PG5432/base/16387/16389       )
2024-11-01 12:11:08  243985/940513 kB (25%), 0/1 tablespace (/u01/PG5432/base/16387/16389       )
2024-11-01 12:11:09  295633/940513 kB (31%), 0/1 tablespace (/u01/PG5432/base/16387/16389       )
2024-11-01 12:11:10  349777/940513 kB (37%), 0/1 tablespace (/u01/PG5432/base/16387/16389       )
2024-11-01 12:11:11  362129/940513 kB (38%), 0/1 tablespace (/u01/PG5432/base/16387/16389       )
2024-11-01 12:11:12  394577/940513 kB (41%), 0/1 tablespace (/u01/PG5432/base/16387/16389       )
2024-11-01 12:11:13  442705/940513 kB (47%), 0/1 tablespace (/u01/PG5432/base/16387/16389       )
2024-11-01 12:11:14  485137/940513 kB (51%), 0/1 tablespace (/u01/PG5432/base/16387/16389       )
2024-11-01 12:11:15  527889/940513 kB (56%), 0/1 tablespace (/u01/PG5432/base/16387/16389       )
2024-11-01 12:11:16  576145/940513 kB (61%), 0/1 tablespace (/u01/PG5432/base/16387/16389       )
2024-11-01 12:11:17  623633/940513 kB (66%), 0/1 tablespace (/u01/PG5432/base/16387/16389       )
2024-11-01 12:11:18  668561/940513 kB (71%), 0/1 tablespace (/u01/PG5432/base/16387/16389       )
2024-11-01 12:11:19  715409/940513 kB (76%), 0/1 tablespace (/u01/PG5432/base/16387/16389       )
2024-11-01 12:11:20  766097/940513 kB (81%), 0/1 tablespace (/u01/PG5432/base/16387/16389       )
2024-11-01 12:11:21  810961/940513 kB (86%), 0/1 tablespace (/u01/PG5432/base/16387/16389       )
2024-11-01 12:11:22  856529/940513 kB (91%), 0/1 tablespace (/u01/PG5432/base/16387/16389       )
2024-11-01 12:11:23  904593/940513 kB (96%), 0/1 tablespace (/u01/PG5432/base/16387/16389       )
2024-11-01 12:11:24  917291/940513 kB (97%), 0/1 tablespace (/u01/PG5432/base/4/2600            )
2024-11-01 12:11:25  928721/940513 kB (98%), 0/1 tablespace (/u01/PG5432/base/5/3456_fsm        )
2024-11-01 12:11:26  940523/940523 kB (100%), 0/1 tablespace (/u01/PG5432/global/pg_control      )
2024-11-01 12:11:26  940523/940523 kB (100%), 1/1 tablespace
2024-11-01 12:11:26  Base backup ended at LSN 0/4A000138
2024-11-01 12:11:26  pg_basebackup: write-ahead log end point: 0/4A000138
2024-11-01 12:11:26  pg_basebackup: waiting for background process to finish streaming ...
2024-11-01 12:11:26  pg_basebackup: syncing data to disk ...
2024-11-01 12:11:31  pg_basebackup: renaming backup_manifest.tmp to backup_manifest
2024-11-01 12:11:31  pg_basebackup: base backup completed
2024-11-01 12:11:32  done
2024-11-01 12:11:32  done
2024-11-01 12:11:32  Extracting config files into /u01/PG5432...
2024-11-01 12:11:32  done
2024-11-01 12:11:32  Starting standby cluster
2024-11-01 12:11:32  Using pg_ctl to start cluster at /u01/PG5432 on 5432...
2024-11-01 12:11:33  pg_ctl: waiting for server to start....2024-11-01 12:11:33.019 NZDT [2475] LOG:  redirecting log output to logging collector process
2024-11-01 12:11:33  pg_ctl: 2024-11-01 12:11:33.019 NZDT [2475] HINT:  Future log output will appear in directory "log".
2024-11-01 12:11:36  pg_ctl: ... done
2024-11-01 12:11:36  pg_ctl: server started
2024-11-01 12:11:36  done
2024-11-01 12:11:36  Applying DR configuration
2024-11-01 12:11:37  PostgreSQL agents updated for DR.
2024-11-01 12:11:37  Applying Observer settings
2024-11-01 12:11:37  Observer enabled.
2024-11-01 12:11:37
Task succeeded

archiving

dbvcli create-standby archiving {-d|--name} CONFIGURATION_NAME [--OPTIONS]

Set up PostgreSQL WAL File Archiving disaster recovery

Option

Type

Description

--observer

Y or N

enable observer

--hot-standby

Y or N

enable hot standby, allowing read-only connections to the standby cluster

--standby-conf-dir

string

directory for the standby cluster config files on standby host

--standby-data-dir

string

directory for the standby cluster data files on standby host

--tablespace-dir

key=val

customize directory on standby for tablespaces

--archive-timeout

string

archive timeout in seconds

--source-backup-dir

string

directory for base backup on source host

--standby-backup-dir

string

directory for base backup on standby host

--source-log-dir

string

directory for archived WAL files on source host

--standby-log-dir

string

directory for archived WAL files on standby host

 Example
-bash-4.2$ ./dbvcli -d PG5433 csd archiving
Connecting to the Control Center at centlin72.oraclekiwi.co.nz:4433 ✓

Checking available actions for this configuration ✓

Standby Cluster Location 1/2
Enter the directory on the standby host that will contain the standby cluster
data files. This directory must be empty or nonexistent.

Standby cluster data files directory:

> /u01/PG5433

Standby Cluster Location 2/2
Enter the directory on the standby host that will contain the standby cluster
configuration files. This directory must be empty or nonexistent.

Standby cluster config files directory:

> /u01/PG5433

Hot Standby
Select whether to enable hot standby, allowing read-only connections to the
standby cluster.

Enable hot standby:

(•) Yes
( ) No

Archiving Mode Configuration 1/5
Enter a directory on the source host to store the base backup of the source
cluster before it is transferred to the standby host.

Source base backup directory:

> /u01/backup/PG5433

Archiving Mode Configuration 2/5
Enter a directory on the standby host to store the base backup of the source
cluster before it is used to create the standby cluster.

Standby base backup directory:

> /u01/backup/PG5433

Archiving Mode Configuration 3/5
Enter a directory on the source host to store archived WAL files before they are
transferred to the standby host.

Source log directory:

> /u01/backup/PG5433

Archiving Mode Configuration 4/5
Enter a directory on the standby host to store archived WAL files before they
are applied by the standby cluster.

Standby log directory:

> /u01/backup/PG5433

Archiving Mode Configuration 5/5
Enter the archive timeout parameter, in seconds, for the source cluster. The
source cluster will archive a WAL file at least this often as long as there are
any WAL entries at all.

Archive Timeout in Seconds

> 120

Observer
Select whether to enable the Observer. The Observer will watch your
Configuration, and notify you on the Dashboard in case any problems are detected
with your Disaster Recovery Configuration.

Enable Observer:

(•) Yes
( ) No

Confirmation
A base backup of the source cluster will be created and transferred to the
standby host, where it will be used to create the standby cluster. Select Yes to
proceed with creating the standby cluster, or No to cancel the operation.

Note: The primary cluster will be restarted.

Create Standby Cluster:

(•) Yes
( ) No

2024-11-01 12:28:08
2024-11-01 12:28:08  Running pre-checks for standby cluster creation
2024-11-01 12:28:08  Preparing to create standby cluster
2024-11-01 12:28:08  Backing up primary cluster
2024-11-01 12:28:08  done
2024-11-01 12:28:08  Using pg_ctl to restart cluster at /u01/PG5433 on 5433...
2024-11-01 12:28:08  pg_ctl: waiting for server to shut down.... done
2024-11-01 12:28:08  pg_ctl: server stopped
2024-11-01 12:28:08  pg_ctl: waiting for server to start....2024-11-01 12:28:08.974 NZDT [3095] LOG:  redirecting log output to logging collector process
2024-11-01 12:28:08  pg_ctl: 2024-11-01 12:28:08.974 NZDT [3095] HINT:  Future log output will appear in directory "log".
2024-11-01 12:28:09  pg_ctl:  done
2024-11-01 12:28:09  pg_ctl: server started
2024-11-01 12:28:09  done
2024-11-01 12:28:09  Creating base backup...
2024-11-01 12:28:09  pg_basebackup: initiating base backup, waiting for checkpoint to complete
2024-11-01 12:28:09  pg_basebackup: checkpoint completed
2024-11-01 12:28:09  Base backup started at LSN 0/4A000028
2024-11-01 12:28:09  pg_basebackup: write-ahead log start point: 0/4A000028 on timeline 1
2024-11-01 12:28:09  pg_basebackup: starting background WAL receiver
2024-11-01 12:28:09  pg_basebackup: created temporary replication slot "pg_basebackup_3112"
2024-11-01 12:28:10   13539/940548 kB (1%), 0/1 tablespace (...3/tmp-3-base-1735978142/base.tar)
2024-11-01 12:28:11  151710/940548 kB (16%), 0/1 tablespace (...3/tmp-3-base-1735978142/base.tar)
2024-11-01 12:28:12  234206/940548 kB (24%), 0/1 tablespace (...3/tmp-3-base-1735978142/base.tar)
2024-11-01 12:28:13  313118/940548 kB (33%), 0/1 tablespace (...3/tmp-3-base-1735978142/base.tar)
2024-11-01 12:28:14  389726/940548 kB (41%), 0/1 tablespace (...3/tmp-3-base-1735978142/base.tar)
2024-11-01 12:28:15  481566/940548 kB (51%), 0/1 tablespace (...3/tmp-3-base-1735978142/base.tar)
2024-11-01 12:28:16  571614/940548 kB (60%), 0/1 tablespace (...3/tmp-3-base-1735978142/base.tar)
2024-11-01 12:28:17  644126/940548 kB (68%), 0/1 tablespace (...3/tmp-3-base-1735978142/base.tar)
2024-11-01 12:28:18  713374/940548 kB (75%), 0/1 tablespace (...3/tmp-3-base-1735978142/base.tar)
2024-11-01 12:28:19  762590/940548 kB (81%), 0/1 tablespace (...3/tmp-3-base-1735978142/base.tar)
2024-11-01 12:28:20  808158/940548 kB (85%), 0/1 tablespace (...3/tmp-3-base-1735978142/base.tar)
2024-11-01 12:28:21  827998/940548 kB (88%), 0/1 tablespace (...3/tmp-3-base-1735978142/base.tar)
2024-11-01 12:28:22  920286/940548 kB (97%), 0/1 tablespace (...3/tmp-3-base-1735978142/base.tar)
2024-11-01 12:28:23  938704/940548 kB (99%), 0/1 tablespace (...3/tmp-3-base-1735978142/base.tar)
2024-11-01 12:28:23  940564/940564 kB (100%), 0/1 tablespace (...3/tmp-3-base-1735978142/base.tar)
2024-11-01 12:28:23  940564/940564 kB (100%), 1/1 tablespace
2024-11-01 12:28:23  Base backup ended at LSN 0/4A000100
2024-11-01 12:28:23  pg_basebackup: write-ahead log end point: 0/4A000100
2024-11-01 12:28:23  pg_basebackup: waiting for background process to finish streaming ...
2024-11-01 12:28:23  pg_basebackup: syncing data to disk ...
2024-11-01 12:28:24  pg_basebackup: renaming backup_manifest.tmp to backup_manifest
2024-11-01 12:28:24  pg_basebackup: base backup completed
2024-11-01 12:28:24  done
2024-11-01 12:28:23  Sending backup to standby
2024-11-01 12:28:24  Sending file 3-base-20241031T232824Z-0_4A000028-0_4A000100-1-3-backup_manifest to centlin72.oraclekiwi.co.nz...
2024-11-01 12:28:24  done
2024-11-01 12:28:24  Sending file 3-base-20241031T232824Z-0_4A000028-0_4A000100-2-3-base.tar to centlin72.oraclekiwi.co.nz...
2024-11-01 12:28:54  done
2024-11-01 12:28:54  Sending file 3-base-20241031T232824Z-0_4A000028-0_4A000100-3-3-pg_wal.tar to centlin72.oraclekiwi.co.nz...
2024-11-01 12:28:55  done
2024-11-01 12:28:55  Creating standby cluster from backup
2024-11-01 12:28:55  Extracting base files into /u01/PG5433...
2024-11-01 12:29:10  done
2024-11-01 12:29:10  Extracting WAL into /u01/PG5433/pg_wal...
2024-11-01 12:29:11  done
2024-11-01 12:29:11  Verifying base backup contents...
2024-11-01 12:29:12  done
2024-11-01 12:29:12  Starting standby cluster
2024-11-01 12:29:12  Using pg_ctl to start cluster at /u01/PG5433 on 5433...
2024-11-01 12:29:12  pg_ctl: waiting for server to start....2024-11-01 12:29:12.970 NZDT [2751] LOG:  redirecting log output to logging collector process
2024-11-01 12:29:12  pg_ctl: 2024-11-01 12:29:12.970 NZDT [2751] HINT:  Future log output will appear in directory "log".
2024-11-01 12:29:18  pg_ctl: ..... done
2024-11-01 12:29:18  pg_ctl: server started
2024-11-01 12:29:18  done
2024-11-01 12:29:18  Applying DR configuration
2024-11-01 12:29:18  PostgreSQL agents updated for DR.
2024-11-01 12:29:18  Applying Observer settings
2024-11-01 12:29:18  Observer enabled.
2024-11-01 12:29:18
Task succeeded
  • No labels