CEPH Volumes Backup with the Bacula bpipe Plugin and RBD Export

We have seen in the past how bpipe makes it possible to backup numerous applications using commands for standard Linux output <http://www.bacula.lat/using-bpipe-to-stream-dumps-vm-clones-and-another-data-to-your-backup/?lang=en>.

rbd is a utility for manipulating images from rare block devices (RBD), used by the Linux rbd driver and the rbd storage driver for QEMU/KVM. RBD images are single block devices that are distributed in objects and stored in a RADOS object store. The size of the objects over which the image is streaked must be a power of two.

The shell script below can be installed on the Bacula client with access to the RBD client, for listing the volumes of a CEPH Pool, snapshot and snapshot export. Differential and incremental backups are supported.

#!/bin/bash
#
# Autorship: Heitor Faria (Copyleft: all rights reversed).
# Tested by: xxxx
E
# It must be called in the INCLUDE sub-resource of the FileSet of bacula-dir.conf, referring to the backup of the client installed on the CEPH machine (for example), by CEPH Pool:
#
# Plugin = "\\|/opt/bacula/scripts/bpipe_rbd %l <pool_ceph>"
# 					     $1     $2
#

time=$(date +%F_%H-%M-%S)

if [[ $1 == 'Incremental|Differential' ]]
  then
    exp="export-diff"
    imp="import-diff"
fi
if [[ $1 == Full ]]
   then
     exp="export"
     imp="import"
fi

for vol in $(rbd -p $2 ls); do
  rbd snap create --pool $2 --image $vol --snap $vol-$time
  echo "bpipe:/var/$vol:rbd $exp --pool $2 --image $vol --snap $vol-$time --path -:rbd $imp --dest-pool $2 --dest $vol --path -"
done

To restore, the original CEPH volume needs to be renamed or deleted.

Likewise, the defined restore command (rdb import) can be replaced later when Bacula is restored to write the volume to disk. Example: dd of=/tmp/volume_name

Disponível em: pt-brPortuguês (Portuguese (Brazil)) enEnglish esEspañol (Spanish)

Leave a Reply

Close Menu