VOOZH about

URL: https://dev.to/michaelfv/gbase-8a-backup-and-restore-guide-full-and-incremental-backups-with-gbackup-37n7

⇱ GBase 8a Backup and Restore Guide: Full and Incremental Backups with gbackup - DEV Community


GBase 8a stores massive analytical datasets across many nodes. If hardware fails, someone drops a table, or an upgrade goes wrong, a solid backup strategy is your only lifeline. This guide covers the official gbackup tool for full and incremental backups, plus mysqldump for finer-grained tasks.

gbackup vs. mysqldump

Aspect gbackup mysqldump
Type Physical backup Logical backup
Speed Fast (copies data files) Slow (generates SQL statements)
Restore speed Fast Slow (re‑executes every statement)
Granularity Database / cluster Database, table
Cross‑platform Weaker Strong (standard SQL)
Best for Full disaster recovery, large volumes Table migration, cross‑platform exports

For production, gbackup is the primary tool. mysqldump fills the gaps when you need per‑table exports.

Full Backup with gbackup

Before You Start

# Verify all nodes are healthy
gcadmin showall

# Ensure the backup directory has enough space (1.5× data size recommended)
df -h /backup/gbase

Run a Full Backup

# Basic full backup
gbackup \
 --backup-dir=/backup/gbase/full_20240601 \
 --backup-type=full \
 --user=gbase --password=your_password \
 --host=coordinator_ip --port=5258

# Compressed full backup (saves 30%–50% storage)
gbackup \
 --backup-dir=/backup/gbase/full_20240601 \
 --backup-type=full --compress \
 --user=gbase --password=your_password \
 --host=coordinator_ip --port=5258

Verify the Backup

ls -lh /backup/gbase/full_20240601/
cat /backup/gbase/full_20240601/backup.log | tail -20
# Look for "backup completed successfully"

Incremental Backups with gbackup

Incremental backups capture only changes since the last backup, so they're fast and compact.

gbackup \
 --backup-dir=/backup/gbase/incr_20240602 \
 --backup-type=incremental \
 --incremental-basedir=/backup/gbase/full_20240601 \
 --user=gbase --password=your_password \
 --host=coordinator_ip --port=5258

Recommended cadence: Full on Sunday, incrementals Monday–Saturday, new full next Sunday. At worst, you lose one day of data.

Restoring from Backups

Full Restore

# Stop the database first
gcadmin stop

grestore \
 --backup-dir=/backup/gbase/full_20240601 \
 --user=gbase --password=your_password \
 --host=coordinator_ip --port=5258

gcadmin start

Full + Incremental Restore

Restore the full backup, then apply each incremental in sequence. The last incremental omits --apply-log-only to finalize the consistent state.

# Restore full backup (don't commit yet)
grestore --backup-dir=/backup/gbase/full_20240601 --apply-log-only \
 --user=gbase --password=your_password

# Apply first incremental
grestore --backup-dir=/backup/gbase/incr_20240602 --apply-log-only \
 --incremental-dir=/backup/gbase/incr_20240602

# Apply last incremental (no --apply-log-only)
grestore --backup-dir=/backup/gbase/full_20240601 \
 --incremental-dir=/backup/gbase/incr_20240603

gcadmin start

mysqldump for Fine-Grained Tasks

# Export a single database
mysqldump -h coordinator_ip -P 5258 -u gbase -p \
 --databases sales_db > /backup/sales_db_20240601.sql

# Export a single table
mysqldump -h coordinator_ip -P 5258 -u gbase -p \
 sales_db orders > /backup/orders_20240601.sql

# Import back
mysql -h coordinator_ip -P 5258 -u gbase -p sales_db < /backup/orders_20240601.sql

Automating with Cron

#!/bin/bash
DATE=$(date +%Y%m%d)
BACKUP_BASE=/backup/gbase
COORD_IP=192.168.1.10

DAY_OF_WEEK=$(date +%u)
if [ "$DAY_OF_WEEK" -eq 7 ]; then
 BACKUP_DIR=$BACKUP_BASE/full_$DATE
 gbackup --backup-dir=$BACKUP_DIR --backup-type=full --compress \
 --user=gbase --password=your_password --host=$COORD_IP --port=5258
else
 LAST_FULL=$(ls -dt $BACKUP_BASE/full_* | head -1)
 BACKUP_DIR=$BACKUP_BASE/incr_$DATE
 gbackup --backup-dir=$BACKUP_DIR --backup-type=incremental \
 --incremental-basedir=$LAST_FULL --compress \
 --user=gbase --password=your_password --host=$COORD_IP --port=5258
fi

# Remove backups older than 30 days
find $BACKUP_BASE -maxdepth 1 -mtime +30 -exec rm -rf {} \;

Add to crontab: 0 2 * * * /bin/bash /usr/local/scripts/gbase_backup.sh

Backup Readiness Checklist

  • Does the backup log end with "completed successfully"?
  • Is the backup file size similar to the previous run?
  • Perform a restore drill at least once a month.
  • Are backups stored off‑site?
  • Does the retention policy meet compliance requirements?

A backup is only as good as your ability to restore it. Run a full restore drill every quarter — when a crisis hits, you'll be glad you did. Protecting your gbase database with a solid backup routine is one of the most important investments a DBA can make.