Migrate InfluxDB from Home Assistant to Standalone Server

Hi,

i have InfluxDB v1 running on my Home Assistant System. The Database ist about 10GB large. Every Backup takes me to long time so i hope someone could help me with an Toutorial to Migrate the Internal InfluxDB v1 to an dedicated server InfluxDBv1 or v2. So i could backup the Database-Server.

if someone can support me I would be very happy about it

Hi,

This is not quite straightforward but I’ve done this, I think the upgrade to v2 didn’t go well so I kept the same version of influxdb

Here are my notes

# /disks/usb1/backups/homeassistant/migration/influx/data/influxdb:/var/lib/influxdb/data

# not so straightforward
# note homeassistant addon comes with kapacitor and Chronograf for easy administration

# influx 1.x

# rsynced old db
# noticed http calls

# CLEAR SUBSCRIPTIONS
# docker exec
# influx
# show subscriptions
# drop subscription "kapacitor-cf39975a-287c-4a16-a44e-b90fe7711603" ON "_internal"."monitor"
# drop subscription "kapacitor-cf39975a-287c-4a16-a44e-b90fe7711603" on "ha"."autogen"

# check new ha is posting data in
# SELECT * FROM "°C" WHERE time > now() - 1h;
# SELECT * FROM "W" WHERE time > now() - 1m;

docker run -d --name="influxdb" \
        --restart=unless-stopped \
        -p 10.0.0.3:8086:8086 \
        -v /_dev/docker/influxdb/influxdb:/var/lib/influxdb \
        docker.io/library/influxdb:1.8.4

Note that the ha password is retained from the old addon

influxdb:
   host: replace_with_your_ip
   port: 8086
   database: ha
   username: homeassistant
   password: !secret influx_pwd
   max_retries: 3
   default_measurement: state

Did the same for Grafana addon, note the admin password is also retained by the old db files

# admin:hassio
docker run --restart=unless-stopped -d --name=grafana -p 10.0.0.3:3000:3000 -v /_dev/docker/grafana:/var/lib/grafana docker.io/grafana/grafana

Sorry that this is not step by step but I’m hoping there’s enough here to give you some direction