Docker Influxdb backup approach?

Hi,

I’m currently using Docker for my OpenHAB and MQTT setup and I’m looking into setting up InfluxDB in a docker container as well for persistence. One thing that I can’t find anything about is backing up the influxdb automatically. There’s note on the Influxdb documentation on how to do so manually using commands but it like to set it up so the backup happens automatically periodically to a cloudprovider like Amazon or Azure so I don’t have to worry about losing any data. From what I read already over here the influxdb databases are very small so the space in the cloud for the backups shouldn’t be more then 1$/year :slight_smile:
There are several Docker containers to automate backups to amazon s3 for MySQL, Postgress but I can’t seem to find any for influxdb.

So I was wondering what your experiences where on this topic? How do you manage you influxdb backups in a docker setup?

Having most of my services running in Docker, I have yet to find somerhing that is worth to backup apart from the config of the containers.

At the end it‘s just some historical data :wink:

I have not read the whole post, but I saw this yesterday.
https://www.influxdata.com/blog/backuprestore-of-influxdb-fromto-docker-containers/

I’ve read that one as well, unfortunately I can’t see a way to automate the process. In addition the backup isn’t of much use if it’s one same hardware. Just checked the influxdb API docs as well but it seems that there isn’t a API for creating backups.

I don’t use offsite backup because I’m with Matthias, I don’t care about the data in Infuxdb that much. All I do is tar up the contents of the folders I mount as a volume to /data and /config. If I wanted to automate it I would write a script and use cron to run it periodically.

hmmm, I like the idea of keeping my data for several years and see if there’s any big changes. Especially when taking into account power consumption data. Anyway, after digging around on the influxdb forum I found the following:

https://hub.docker.com/r/jacobtomlinson/influxdb-to-s3/

which looks promising. It removes the latest backup database as well from s3 so no need to worry about an increased bill after a while :slight_smile:

I use Rancher to manage my Docker containers and I highly recommend it. I have not done this (yet, but I use Influx) but you can easily automate backups with either the Rancher cron containerset or they have a generic DB backup tool.

Honestly if you just take the backup line in the link @christoph_wempe gave and do as @rlkoshak suggested. You can easily make a small bash script to create a dated folder,

#!/bin/bash
toFolder = $(date +"%m_%d_%Y")
mkdir $toFolder
influx backup –database openhab “$folder/openhab.backup”

At the end the container will stop (0) and you can start it in a few hours/day. I’m guessing these are for data integrity so you make not need to worry about making a robust restore process, just handle it if you lose data unexpectedly. Of course make sure you put the newly created folder docker mounted somewhere safe.

-J