Backup¶
Backup¶
Storware & Commvault¶
Onteon Tech HA PostgreSQL® has been successfully tested and can be easily integrated with the following backup and recovery solutions:
- Storware (custom script, using pg_basebackup),
- Commvault (native replication).
Hetman¶
The Onteon Tech HA PostgreSQL® solution comes with Hetman built-in, a scheduler and automation tool. Hetman can be utilized to schedule and execute any backup method offered by PostgreSQL.
For example, create a bash script, which runs pg_basebackup, upload it to Hetman and schedule to run automatically every two hours.
pg_basebackup¶
For more details, visit official pg_basebackup documentation.
Example backup command:
export PGUSER="postgres"
export PGPASSWORD="postgres"
export PGPORT="5432"
export PGHOST="${PRIMARY_WOKRER_IP}"
pg_basebackup \
-D "$(pwd)" \
-w \
--checkpoint="fast" \
--format="tar" \
--gzip \
--progress \
--verbose \
--wal-method="fetch"
Restore¶
Stop PostgreSQL using pg_ctl from the binary files directory ${onteon_node_manager_path}/store/drbd/onteon-ha-resource-0/postgresql/application/lib/bin (see Configuration table).
To restore the database backup, firstly remove content of the data directory at ${onteon_node_manager_path}/store/drbd/onteon-ha-resource-0/postgresql/data on the Primary worker (see Configuration table).
In the next step untar the backup .tar file into the data directory.
Set the correct owner (onteon user) and permissions of the untarred backup files.
chown -R onteon:onteon ${onteon_node_manager_path}/store/drbd/onteon-ha-resource-0/postgresql/data
chmod -R 750 ${onteon_node_manager_path}/store/drbd/onteon-ha-resource-0/postgresql/data
Start PostgreSQL using pg_ctl from the binary files directory ${onteon_node_manager_path}/store/drbd/onteon-ha-resource-0/postgresql/application/lib/bin (see Configuration table).