Releasing the v0.1.1 of ceph_rbd_bck.sh. Here is a script I created in my spare time to create a backup solution for Ceph. I wrote this to provide an opensource solution to backing Ceph pools. I needed something to not only backup individual images in specified pools, but to also be able to set retention dates, and implement a synthetic full backup schedule. This is an extremely easy script intended help other people backup thier systems, or develop a more robust backup solution.
See the full script over at github Ceph Backup Script
First it should be noted that this script was created and tested on a machine running Centos 7.2. It may as is on other distros, or need minor tweaking to get working right. The machine you are running this on will need two basic things
- Admin access to your current Ceph Cluster
- A place to your backups (I recommend NOT on the cluster you are currently backing up)
This can be done from your admin node in Ceph using ceph-deploy
To get started please create working directory for us to put our scripts and config files in. By default the config directory will be in /opt/ceph_backups/config
These config files are extremely simple and are for each individual pool. This will allow you to fine tune any pool to your liking and setup a staggered backup schedule. These should be placed in /opt/ceph_backups/config and have the ‘.conf’ file extension. Each pool will require its own separate config file.
This is easy enough, by call ing log with a text string this will log it to a file. Note that cat’ing the file will produce color coded error tags, while opening it in vi will look off due to tput.
This finds everything less than 7 days old (mtime -6), excluding tar.gz files, in the backup folder for the specific image.
If the archive exsits, remove all the old files and purge all snapshots. This will trigger a new full and initial snapshot to be created.
This finds everything older than a given varible “[retention_time]“ (mtime +[retention_time]) in the backup folder for the specific image and deletes it. This is very simple and is just here to delete old archive files. Note: I will add in eventually a safeguard to ensure that only compressed archives get the axe.