DEV Community

Michael
Michael

Posted on • Originally published at gbase.cn

Remote Physical Backup and Recovery in GBase 8c Centralized Mode

Backups are your last line of defense against hardware failure, human error, and disasters. GBase 8c, the China‑domestically developed multi‑model database from GBASE, ships with gs_probackup for remote physical backups. This guide covers end‑to‑end configuration, full and incremental backups, and recovery from a dedicated backup server.

Backup Configuration

Enable WAL Archiving

First, turn on WAL archiving and related parameters on the database node:

gs_guc reload -N all -I all -c "archive_mode=on"
gs_guc reload -N all -I all -c "archive_timeout=1800"
gs_guc reload -N all -I all -c "archive_command = 'scp %p gbase@192.168.138.202:/data/archivelog/%f'"
gs_guc reload -N all -I all -c "enable_cbm_tracking=on"
Enter fullscreen mode Exit fullscreen mode
  • archive_mode — enables WAL archiving.
  • archive_timeout — maximum interval between forced archive operations.
  • archive_command — the shell command used to ship WAL segments (an absolute destination path is recommended).
  • enable_cbm_tracking — required for full and incremental backups.

Grant Access to the Backup Server

Allow remote replication connections from the backup machine and set up passwordless SSH from the backup user to the database OS user:

gs_guc reload -N all -I all -h "host replication all 0.0.0.0/0 md5"
Enter fullscreen mode Exit fullscreen mode
ssh-keygen -t rsa
ssh-copy-id user@remote_host
Enter fullscreen mode Exit fullscreen mode

Initialize the Backup Catalog

On the backup server, create the backup directory, register the instance, and define retention rules:

gs_probackup init -B /home/gbase/backup
gs_probackup add-instance -B /home/gbase/backup -D /home/gbase/backup --instance gbase_cluster \
    --remote-host 192.168.138.201 --remote-user gbase
gs_probackup set-config -B /home/gbase/backup --instance gbase_cluster \
    --retention-redundancy 7 --retention-window 7
gs_probackup show-config -B /home/gbase/backup --instance gbase_cluster
Enter fullscreen mode Exit fullscreen mode
  • init — initializes a backup directory.
  • add-instance — registers an instance (multiple instances are supported).
  • set-config — sets retention policies.
  • show-config — displays current backup configuration.

Physical Backup

Full Backup

gs_probackup backup -B /home/gbase/backup -b FULL -h 192.168.138.201 -p 15400 \
    -U backup -W XXXX --instance gbase_cluster --delete-expired -d postgres \
    --compress-algorithm=zlib --compress-level=5 \
    --remote-host 192.168.138.201 --remote-user gbase
Enter fullscreen mode Exit fullscreen mode

Key parameters: -B backup directory; -b FULL full backup; -h/-p database host and port; -U/-W backup role and password; --instance instance name; --delete-expired removes expired backups after the job; -d database to connect to; --compress-algorithm/--compress-level compression method and level; --remote-host/--remote-user remote server and its OS user.

Incremental Backup

An incremental backup requires a successful full backup as its base:

gs_probackup backup -B /home/gbase/backup -b PTRACK -h 192.168.138.201 -p 15400 \
    -U backup -W XXXX --instance gbase_cluster --delete-expired -d postgres \
    --compress-algorithm=zlib --compress-level=5 \
    --remote-host 192.168.138.201 --remote-user gbase
Enter fullscreen mode Exit fullscreen mode

-b PTRACK switches to incremental mode; all other parameters remain the same as full backup.

Recovery

To avoid secondary corruption, restore to a different machine or directory first and validate the data before moving it into production.

Remote Recovery

Perform recovery directly from the backup server to a target server:

gs_probackup restore -B /home/gbase/backup/ --instance=gbase_cluster \
    -D /home/gbase/restore_test -i SMV8NY \
    --remote-host=192.168.138.202 --remote-user=gbase
Enter fullscreen mode Exit fullscreen mode

Bring up the restored instance and verify:

gs_ctl start -D /home/gbase/restore_test/
Enter fullscreen mode Exit fullscreen mode

-i SMV8NY pins the restore to a specific backup ID.

Local Recovery

Copy the backup files to the target machine first, then run the restore locally:

gs_probackup restore -B /home/gbase/backup/ --instance=gbase_cluster \
    -D /home/gbase/restore_test -i SMV8NY
Enter fullscreen mode Exit fullscreen mode

Start and validate:

gs_ctl start -D /home/gbase/restore_test/
Enter fullscreen mode Exit fullscreen mode

gs_probackup provides a solid foundation for remote physical backup and off‑site recovery in a gbase database, helping you meet data safety SLAs with GBASE's enterprise tools.

Top comments (0)