Overview
Rsync Backup Tool is a specialized utility designed for creating efficient, secure backups of blockchain validator nodes and associated data. Built on the powerful rsync utility, it offers both full and incremental backup capabilities with robust error handling and notification features.
For blockchain validators, having reliable backups is crucial for maintaining network participation and recovering from potential failures. This tool simplifies the backup process by providing a configurable, scriptable solution that can be easily integrated into existing infrastructure.
The tool is particularly useful for Cosmos-based blockchain validators, but can be used for any type of server or data that needs to be backed up regularly and efficiently.
Key Features
- Multiple Backup Types - Support for both full and incremental backups to optimize storage and bandwidth usage.
- SSH Key Authentication - Secure authentication using SSH keys for remote server connections.
- Customizable Paths - Flexible configuration allows backing up specific directories and excluding others.
- Bandwidth Limiting - Option to limit bandwidth usage to prevent network congestion during backups.
- Compression Support - Compress backups on-the-fly to reduce storage requirements and transfer times.
- Email Notifications - Receive notifications on backup completion or failure for monitoring purposes.
- Detailed Logging - Comprehensive logging of backup operations for auditing and troubleshooting.
Installation
Rsync Backup Tool can be installed directly from GitHub:
git clone https://github.com/ChainTools-Tech/rsync_backup_tool
cd rsync_backup_tool
chmod +x backup.sh
Requirements
- Linux/Unix-based operating system
- rsync utility installed on both source and destination servers
- SSH access to the remote backup server
- SSH key-based authentication configured (recommended)
Usage
Configure the tool and run backups with simple commands:
# Run a backup with default configuration
./backup.sh
# Specify a custom configuration file
./backup.sh -c /path/to/custom-config.conf
# Run a full backup (overriding incremental setting)
./backup.sh --full
# Use verbose mode for detailed output
./backup.sh -v
Configuration
Create a configuration file to customize backup behavior:
# Rsync Backup Tool Configuration
# Source and destination settings
SOURCE_DIR="/home/validator/data"
DEST_USER="backup-user"
DEST_HOST="backup-server.example.com"
DEST_DIR="/mnt/backup-storage/validator-backup"
# Backup settings
BACKUP_TYPE="incremental" # Can be "full" or "incremental"
INCREMENTAL_DIR="/mnt/backup-storage/validator-backup/incremental"
RETENTION_DAYS=30 # How many days to keep backups
# Performance settings
BANDWIDTH_LIMIT="10000" # Limit in KB/s (10MB/s)
COMPRESSION="true" # Use compression during transfer
# Notification settings
EMAIL_NOTIFICATION="true"
EMAIL_RECIPIENT="admin@example.com"
# Exclude patterns (space-separated)
EXCLUDE_PATTERNS=".git temp/* *.tmp"
Backup Types and Examples
The tool offers multiple backup strategies to suit different needs:
Full Backup
A full backup creates a complete copy of the specified source directory. This is useful for initial backups or when you need a complete point-in-time snapshot.
# Run a full backup
./backup.sh --full
# Output example:
[2025-05-01 14:30:12] Starting full backup of /home/validator/data
[2025-05-01 14:30:12] Destination: backup-user@backup-server.example.com:/mnt/backup-storage/validator-backup
[2025-05-01 14:32:45] Backup complete - 1.2 GB transferred
[2025-05-01 14:32:46] Backup verification successful
Incremental Backup
Incremental backups only transfer files that have changed since the last backup, saving bandwidth and storage space while still maintaining historical versions.
# Run an incremental backup
./backup.sh
# Output example:
[2025-05-02 14:30:10] Starting incremental backup of /home/validator/data
[2025-05-02 14:30:10] Using reference snapshot from: 2025-05-01
[2025-05-02 14:30:45] Backup complete - 15.7 MB transferred
[2025-05-02 14:30:46] Backup verification successful
Backup Automation
You can automate the backup process by setting up a cron job:
Example Cron Schedule
# Edit crontab
crontab -e
# Add the following line for daily backups at 2:00 AM
0 2 * * * /path/to/rsync_backup_tool/backup.sh >> /var/log/backup.log 2>&1
# For weekly full backups and daily incremental backups
0 2 * * 0 /path/to/rsync_backup_tool/backup.sh --full >> /var/log/backup.log 2>&1
0 2 * * 1-6 /path/to/rsync_backup_tool/backup.sh >> /var/log/backup.log 2>&1
Setting Up Email Notifications
To receive email notifications about backup status, configure the email settings in your config file:
EMAIL_NOTIFICATION="true"
EMAIL_RECIPIENT="admin@example.com"
SMTP_SERVER="smtp.example.com"
SMTP_PORT="587"
SMTP_USER="notifications@example.com"
SMTP_PASSWORD="your-secure-password"
EMAIL_SUBJECT_PREFIX="[BACKUP]"
Related Resources
- Rsync Documentation - Official manual for the rsync utility
- Blockchain Data Backup Best Practices - Guide for backing up Cosmos blockchain data
- Cron Job Scheduling Guide - Information on how to set up automated scheduling using cron