A command-line utility for performing database backups and restorations, supporting both SQL and MongoDB databases with encryption and compression capabilities.
This Java-based CLI tool automates database backup and restore operations with built-in support for encryption, compression, and progress tracking. It provides a straightforward interface for managing database backups across different database types.
- Multi-database support (SQL and MongoDB)
- AES encryption for secure backups
- Automatic compression
- Real-time progress monitoring
- Flexible restoration options
- Java 21 or later
- Access to command-line interface
- Database connection credentials
git clone https://github.com/YourUsername/DatabaseBackupProject.git
cd DatabaseBackupProject
Generate a new encryption key:
--generate key
Set database connection parameters:
--db <dbType> --url <url> [--password <password>] [--user <user>] [--dbName <database name>]
Create a new backup:
--do backup [--entity [entity1, entity2]] [--key <encryption key>]
Restore from backup:
--restore --foldertypedb <mongo/sql> --folderName <folder name> [--saves [save1, save2]] [--key <encryption key>]
List available backups:
--list [mongo/sql] [--folder <folder name>]
View available commands:
--help
The utility uses AES encryption for backup security. When using encryption:
- Store encryption keys securely
- Required for both backup and restore operations
- Cannot recover encrypted backups without the original key
- Configure database connection:
--db sql --url jdbc:mysql://localhost:3306 --user admin --password securepass --dbName production
- Create encrypted backup:
--do backup --entity [users, accounts] --key MY_SECURE_KEY
- Restore specific tables:
--restore --foldertypedb sql --folderName backup_20250128 --key MY_SECURE_KEY
Backups are automatically organized in the user's home directory:
~/backups/
├── sql/
│ └── backup_yyyyMMdd_HHmmss.sql.gz
└── mongo/
└── backup_yyyyMMdd_HHmmss.json.gz
We welcome contributions to improve the utility. Please submit issues and pull requests through our GitHub repository.
This tool performs critical database operations. Always test thoroughly in a non-production environment before using in production systems.