Backup the Database:
The most important settings are all stored in the Database. The easiest and most secure way to save them is to export all the Data at a specific time and store them on the Synology Raid. So this is my solution:
- Go to „Control Panel“ -> „Task Schedueler“ and create a „User-defined script“
- Choose the name you want to have and set the User to „root“
- Choose the time you want to have the script running
- Change the code to your settings.
docker exec Zabbix-Server /usr/bin/mysqldump -u root --password=zabbix zabbix > /volume1/docker/Zabbix/backup.sql
tar -zcvf /volume1/docker/Zabbix/$(date +%Y%m%d).tar.gz /volume1/docker/Zabbix/backup.sql
rm /volume1/docker/Zabbix/backup.sql
Restore Database
If you want to restore your Database you have to enable SSH and connect with your Terminal. Then you can paste following command: (Attention you have to unpack the tar file if you use my Backup scirpt
cat /volume1/docker/Zabbix/backup.sql | docker exec -i Zabbix-Server /usr/bin/mysql -u zabbix --password=zabbix zabbix
Links:
https://gist.github.com/spalladino/6d981f7b33f6e0afe6bb
2 comments for “Synology Docker Zabbix Backup and Restore”