- Docker and Docker Compose
- Python 3.x
- MongoDB
- FastDFS
# Clone the repository
git clone <repository-url>
cd DDBS-Final
# Initialize the system
./scripts/main.sh init.
├── app/ # Application code
├── backend/ # Backend services
├── configs/ # Configuration files
├── data_load/ # Data loading scripts
├── db-generation/ # Database generation tools
├── docker/ # Docker configuration
├── scripts/ # Management scripts
│ ├── main.sh # Main entry point
│ ├── db/ # Database scripts
│ ├── storage/ # Storage scripts
│ ├── backup/ # Backup scripts
│ └── utils/ # Utility scripts
└── initialization.sh # System initialization
./scripts/main.sh init- Initialize the entire system./scripts/main.sh backup- Create a system backup./scripts/main.sh restore- Restore from backup./scripts/main.sh clear- Clear all data./scripts/main.sh help- Show help message
Located in scripts/db/:
mongo_drop.sh- Drop MongoDB databasesmongo_dump.sh- Dump MongoDB databasesmongo_restore.sh- Restore MongoDB databasesclear_ddbs1.sh- Clear DDBS1 instanceclear_ddbs1_bak.sh- Clear DDBS1 backup
Located in scripts/storage/:
bulk_load_file.sh- Load files into FastDFSclear_storage.sh- Clear FastDFS storage
Located in scripts/backup/:
backup_all.sh- Complete system backuprestore_all.sh- Complete system restorebackup_ddbs1.sh- Backup DDBS1 instancerestore_in_ddbs_1.sh- Restore DDBS1 instancefuse_ddbs1_from_bak.sh- Fuse DDBS1 from backup
./scripts/main.sh initThis will:
- Clean up existing data
- Start Docker services
- Initialize databases
- Load initial data
- Generate additional data
- Set up file storage
./scripts/main.sh backupBackups are stored in /data_load/backups/ with timestamp-based directories.
./scripts/main.sh restore [timestamp]If no timestamp is provided, you'll be prompted to select from available backups.
./scripts/main.sh clearThis will clear all databases and storage without removing container configurations.
Backups are stored in timestamped directories:
/data_load/backups/YYYYMMDD_HHMMSS/
├── mongo1/ # DDBS1 MongoDB backup
├── mongo2/ # DDBS2 MongoDB backup
├── storage0_backup.tar.gz # Storage0 FastDFS backup
└── storage1_backup.tar.gz # Storage1 FastDFS backup
The backup system automatically:
- Creates timestamped backup directory
- Dumps MongoDB databases
- Archives FastDFS storage
- Copies all data to backup location
The restore process:
- Lists available backups if no timestamp provided
- Validates backup directory existence
- Restores MongoDB databases
- Restores FastDFS storage
- Rebuilds necessary indices
-
Docker Services Not Starting
# Check docker service status docker ps # Restart docker services docker-compose down && docker-compose up -d
-
Database Connection Issues
# Check MongoDB status docker exec ddbs_mongo_1 mongo --eval "db.stats()"
-
Storage Issues
# Check FastDFS status docker exec storage0 fdfs_monitor /etc/fdfs/client.conf
- Docker logs:
docker logs <container_name> - MongoDB logs: Check container logs for ddbs_mongo_1 and ddbs_mongo_2
- FastDFS logs: Check container logs for storage0 and storage1
For additional help or issues, please refer to the project documentation or create an issue in the repository.