A lightweight, configurable Python tool for automated MongoDB backups with scheduling, filtering, compression, and cleanup.
- Scheduled backups (via cron or manual execution)
- Exclude specific databases from backups
- .tar.gz compression for reduced storage usage
- Auto-pruning to limit the number of stored backups
- .env-based configuration for flexibility
- Python 3.7+
- MongoDB
- Python packages:
pip install python-dotenv
- Clone this repository:
git clone https://github.com/yourname/mongo-vault.gitcd mongo-vault - Create and activate a virtual environment (optional but recommended):
python3 -m venv venvsource venv/bin/activate - Install required Python packages:
pip install python-dotenv - Copy the .env-example file to .env and fill in your MongoDB details:
cp .env-example .env - Configure your preferences in the .env file (MongoDB credentials, backup directory, etc.).
You can run the backup manually with the following command: python3 mongo_backup.py
You can schedule the backup using cron, or any other scheduler. Steps for this won't be shown.