Skip to content

Instantly share code, notes, and snippets.

@sxd
Created July 24, 2017 20:57
Show Gist options
  • Save sxd/c89b88c5804c3ecfff111066c3d469a3 to your computer and use it in GitHub Desktop.
Save sxd/c89b88c5804c3ecfff111066c3d469a3 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
HOST=$1
DEST=$2
DATE=`date +%Y-%m-%d`
influxd backup -host $HOST:8088 $DEST/$DATE/metadata/
DATABASES=`influx -execute "show databases" | sed -e 's/^name.*//;s/----//'`
for DB in $DATABASES; do
influxd backup -host $HOST:8088 -database $DB $DEST/$DATE/datadir/$DB
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment