Backup of influxdb to stdout


I’m running Bareos for backing up my machines.

Before starting the backup, Bareos runs a influx backup $backupdir command and cleans the backup directory afterwards.
This was nice until the influxdb grew bigger and I ran out of disk space in the backup directory.

Now that Bareos supports virtual files that are fed from the output of, for example, an external command, I’d like to write a Bareos plugin that makes use of this.

Therefore I need a way to stream the influx backup to stdout. Since influx backup does not support this, I thought of something like

for org in $(influx org list --json | jq -r .[].name); do
  for bucket in $(influx bucket list -o "${org}" --json | jq -r '.[].id'); do
    influxd inspect export-lp --bucket-id "${bucket}" \
      --engine-path /var/lib/influxdb/engine --output-path -
  influx export all -o "${org}"
sqlite3 /var/lib/influxdb/influxd.sqlite .dump

(this example is not meant to work, just to get the idea)

and additionally saving /var/lib/influxdb/influxd.bolt.

Is there something missing in order to be able to restore all buckets, tasks, orgs, users, notebooks, dashboards, graphs, etc.?

What’s the right restore procedure? influx write --bucket $mybucket, restoring the sqlite3/bolt databases, what else?

Thanks in advance!

Hello @phil_fry,
Here’s docs on backup and restore:
Back up data in InfluxDB | InfluxDB OSS v2 Documentation
Restore data in InfluxDB | InfluxDB OSS v2 Documentation.

(putting this there for future ppl who run across this)

I’ve never seen someone stream the backup to stdout. That looks pretty good though. I think you should be good.