I needed a handy way to backup my Graphite cluster to reliable storage such as Amazon S3 or OpenStack Swift. Also, the ability to restore that data in a sane away.
$ whisper-backup --logfile /opt/graphite/storage/log/whisper-backup/whisper-backup.log \
--bucket fitbit.graphite.$(hostname -s) \
--retention 5 \
--quiet \
backup swift
I decided not to design this to store multiple servers worth of WSP files in a single bucket/container of the storage service. For large clusters this could be millions of files which may cause slowness with the API and other issues. So if you have multiple servers you should set each machine to backup to its own bucket/container.
$ python whisperbackup.py --help
Usage: whisperbackup.py [options] backup|restore|purge|list swift|s3 [storage args]
Options:
-p PREFIX, --prefix=PREFIX
Root of where the whisper files live or will be
restored to, default /opt/graphite/storage/whisper
-f PROCESSES, --processes=PROCESSES
Number of worker processes to spawn, default 4
-r RETENTION, --retention=RETENTION
Number of unique backups to retain for each whisper
file, default 5
-x PURGE, --purge=PURGE
Days to keep unknown Whisper file backups, -1 disables,
default 45
-n, --noop Do not modify the object store, default False
-b BUCKET, --bucket=BUCKET
The AWS S3 bucket name or Swift container to use,
default graphite-backups
-m METRICS, --metrics=METRICS
Glob pattern of metric names to backup or restore,
default *
-c DATE, --date=DATE String in ISO-8601 date format. The last backup before
this date will be used during the restore. Default is
now.
-d, --debug Minimum log level of DEBUG
-q, --quiet Only WARN and above to stdout
--nolog Do not log to LOGFILE
--logfile=LOGFILE File to log to, default /var/log/whisperbackup.py
--nolock Do not use a lockfile
--lockfile=LOCKFILE Lock file, default /var/tmp/whisperbackup.py
--locktimeout=LOCKTIMEOUT
Lock timeout in seconds, default 90
--splay=SPLAY Sleep a random time between 0 and N seconds before
starting, default 0
-h, --help show this help message and exit
Notes:
Required python packages and the versions of which I've tested with.
For AWS S3 support:
For OpenStack Swift support:
Content type
Image
Digest
sha256:88a14806a…
Size
174.4 MB
Last updated
almost 11 years ago
docker pull banno/whisper-backup