Backing up your Vertica database is essential for data protection and disaster recovery. This Knowledge Base article
provides step-by-step instructions for setting up a backup script for your Vertica database using the vbr.py utility.
DX NetOps Performance Management All Releases
Prerequisites:
Steps:
#!/bin/bash
# Define variables
VERTICA_USER="dbadmin"
VERTICA_PASSWORD="your_password"
BACKUP_DESTINATION="/path/to/backup/directory"
LOG_FILE="/path/to/log/backup.log"
CONFIG_FILE="/etc/vbr.ini"
# Set the environment variables
export VERTICADATA=/your/vertica/data/directory
# Run the backup using vbr.py utility
/usr/local/vertica/bin/vbr.py --task backup --config-file $CONFIG_FILE --backup-target $BACKUP_DESTINATION --no-validation -p $VERTICA_PASSWORD -d
# Check the backup status
if [ $? -eq 0 ]; then
echo "$(date +"%Y-%m-%d %H:%M:%S") Backup succeeded" >> $LOG_FILE
# Validate backup integrity
/usr/local/vertica/bin/vbr.py --task full-check --config-file $CONFIG_FILE
# Compress the backup file
tar -czf $BACKUP_DESTINATION/backup_$(date +"%Y%m%d%H%M%S").tar.gz $BACKUP_DESTINATION/*.tar
# Remove uncompressed backup file
rm $BACKUP_DESTINATION/*.tar
else
echo "$(date +"%Y-%m-%d %H:%M:%S") Backup failed" >> $LOG_FILE
fi
NOTE -