Automatic Database Backups to Cloud
CompletedHello everyone. Since version 4, Witness automatically does a backup once a week of the database. I'm not very good about staying on top of manual backups or making sure database files automatically created are updated off site. Because of this, i went looking for a solution to easily automate backing up the database files off site. It is easy enough to re-create an installation of Witness in the event of a hardware failure if one has the database files.
https://support.networkoptix.com/hc/en-us/articles/360035832534-Automatic-Database-Backup
I coupled this with a free / open source piece of software called Rclone
It is similar to rsync but it has built in integrations with many cloud providers (AWS, dropbox, google drive, backblaze etc).
On linux one can just add a line to crontab. The file path in the example is for a Wave installation and will vary depending on the flavor of Witness.
0 20 * * * rclone -v --log-file /*DIRECTORY*rclone_db.log copy /opt/hanwha/mediaserver/var/backup/ *CLOUD*:/*PATH*
0 20 * * * rclone -v --log-file /home/waveuser/rclone_db.log copy /opt/hanwha/mediaserver/var/backup/ aws:/wave_backup/
This will run rclone in verbose mode and write that output to a logfile at the user specified path at 8:00pm daily. Rclone will check the files in the backup directory against what already exists on the cloud server. if the files haven't changed then no data will be uploaded. The sync command in rclone could be used instead of copy and it would make the cloud folder match the local. This would mean deletion of the old database backups as new ones are made.
The time stamps on the backup files are in 13 digit unix epoch time. If you need to go back and use one of the backups and want to see the time/date on the file in a more readable form, use an online converter.
https://www.epochconverter.com/
A similar process can be followed on a windows based installation using powershell and task scheduler. File paths and scripting varies slightly but it is the same idea.
I have implemented this across the wave / spectrum installations under management and so far it has been running well. I figured some of the users here could benefit from this as well.
-
Hi Doug Makino,
Thanks for this great sharing and work. I believe this can benefit some users that need to remotely backup the DB files. Appreciate your work and thanks for the kind sharing.
0
Please sign in to leave a comment.
Comments
1 comment