You can back up PostgreSQL databases to Commvault Unified Data Vault using WAL-G, allowing you to leverage Commvault's secure, scalable storage while maintaining your existing backup workflows.
Backing Up PostgreSQL to Unified Data Vault Using WAL-G
WAL-G (Write-Ahead Logging – Go) is a high-performance backup and restore tool for databases, primarily designed for PostgreSQL, MySQL, MongoDB, and other relational or document databases. It is a successor to WAL-E, written in Go for speed and reliability. WAL-G focuses on streaming backups, incremental backups, and integration with cloud object storage, making it suitable for modern cloud-native architectures.
Why WAL-G is Ideal for S3-Compatible Backup
WAL-G works with any storage exposing S3 APIs, enabling vendor flexibility and eliminating dependency on AWS. This supports private or hybrid cloud deployments while maintaining compatibility with standard S3 backup workflows.
Getting Started
System Requirements
- PostgreSQL database instance
- WAL-G installed on the PostgreSQL server or client machine
- Linux machine that can access both PostgreSQL and the Commvault S3 endpoint
Installation
Install WAL-G on your PostgreSQL server. For installation instructions, see the WAL-G documentation.
Before You Begin
Ensure that your infrastructure administrator has created an S3 endpoint.
Environment Setup
Configure the following environment variables to connect WAL-G to your Commvault S3 endpoint:
export WALG_S3_PREFIX=s3://postgress3
export AWS_ENDPOINT=http://sky.testlab.commvault.com
export AWS_ACCESS_KEY_ID='AKIAlgG1A7xgf5pKHYdTA79D'
export AWS_SECRET_ACCESS_KEY='0qxqC975jtWM=P9cD=58uBBLWu6CTlvfwgMiCA87'
Replace the values with your specific configuration:
WALG_S3_PREFIX: The S3 bucket name for PostgreSQL backupsAWS_ENDPOINT: Your Commvault S3 endpoint URLAWS_ACCESS_KEY_ID: Your S3 access keyAWS_SECRET_ACCESS_KEY: Your S3 secret key
Configure PostgreSQL for WAL Archiving
To enable continuous WAL file uploads to the Unified Data Vault, configure the following parameters in your postgresql.conf file. This ensures WAL files are archived during and after backups. PostgreSQL closes the current WAL file after 60 seconds if WAL activity is low, allowing it to be archived.
Add these parameters to your PostgreSQL configuration:
wal_level = replica
archive_mode = on
archive_command = 'wal-g wal-push %p'
archive_timeout = 60
listen_addresses = '*'
Restart the PostgreSQL server to apply the configuration changes.
Verify WAL File Integrity
Before and after backups, verify that WAL files form a complete chain:
wal-g wal-verify integrity
Run PostgreSQL Backup
Use the following command to perform a full backup of your PostgreSQL database:
wal-g backup-push /postgres/data/pgdata --full
Example output:
INFO: 2026/01/14 15:27:21.458456 Backup will be pushed to storage: default
INFO: 2026/01/14 15:27:21.508828 Doing full backup.
INFO: 2026/01/14 15:27:21.516561 Calling pg_start_backup()
...
INFO: 2026/01/14 15:41:11.788247 Starting part 117 ...
INFO: 2026/01/14 15:41:11.789526 backup_label
INFO: 2026/01/14 15:41:11.789692 tablespace_map
INFO: 2026/01/14 15:41:11.790054 Finished writing part 117.
INFO: 2026/01/14 15:41:11.814247 Querying pg_database
INFO: 2026/01/14 15:41:13.821120 Wrote backup with name base_00000001000000250000008B to storage default
Post-Backup Validation
After completing the backup, verify WAL file integrity again:
wal-g wal-verify integrity
If you detect any inconsistencies in the WAL file chain, force a WAL switch and re-verify:
psql -c "SELECT pg_switch_wal();"
sleep 5
ls /postgres/data/pgdata/pg_wal/archive_status/ | grep ".ready" | wc -l
Ensure the .ready count is zero and that wal-verify integrity returns OK.
List PostgreSQL Backups
Use the following command to view all available backups stored in the Unified Data Vault:
wal-g backup-list
Example output:
INFO: 2026/01/14 15:59:07.024369 List backups from storages: [default]
backup_name modified wal_file_name storage_name
base_0000000100000016000000BA 2026-01-14T05:54:25Z 0000000100000016000000BA default
base_00000001000000250000008B 2026-01-14T10:11:13Z 00000001000000250000008B default
Restore PostgreSQL Backups
Use the following command to restore a specific backup from the Unified Data Vault:
wal-g backup-fetch /postgres/data/restore/ base_00000001000000250000008B
Example output:
INFO: 2026/01/14 16:04:13.154436 Selecting the backup with name base_00000001000000250000008B...
INFO: 2026/01/14 16:04:13.154925 Backup to fetch will be searched in storages: [default]
INFO: 2026/01/14 16:05:18.566538 Finished extraction of part_008.tar.lz4
INFO: 2026/01/14 16:05:19.430146 Finished extraction of part_006.tar.lz4
...
INFO: 2026/01/14 16:12:21.666749 Finished extraction of part_114.tar.lz4
INFO: 2026/01/14 16:12:21.694423 Finished extraction of pg_control.tar.lz4
INFO: 2026/01/14 16:12:21.709959 Finished extraction of backup_label.tar.lz4
INFO: 2026/01/14 16:12:21.710242
Backup extraction complete.
Additional Resources
For more information about WAL-G features and advanced configuration options, see the WAL-G documentation.