Move influxdb to another server (with openHAB)

I want to move my debian installation of openHAB and influxdb/grafana to an RPi4. I have an idea now what to do with my openHAB installation. But how can I move 2 years of sampled influxdb data to the new influxdb installation on the RPi4 ? And yes, if I don’t need to recreate all the grafana graphs that would also save quite some time. But it is more important, not to loose the persistence data.

Any idea is welcome. The old influxdb runs on buster and shows InfluxDB shell version: 1.8.10. The new one runs on bullseye and shows InfluxDB shell version: 1.6.7~rc0.

Any ideas ?

Did you already find

?

On the RPi: bash: influx_inspect: command not found

On the PC I tried this already:

influxd backup -portable /etc/openhab/backup/db

Well, influx_install should be part of the installation. Try to figure out how to get the tool up and running.

Please don’t write in german, as this is an international community.
If you prefer german language (which is very ok :slight_smile: ) consider to use the not official
https://openhabforum.de/
which is pretty active.

Ups, didn’t notice that I switched to German → fixed that one.
I noticed that I somehow messed with the wrong Influx version / repository. That’s why there was a lower version on the later installation. Now I have version 1.8.10 and influx_inspect is available.

1 Like

I finally created two bash scripts. One running on the old machine. It is creating the backups and placing them into a folder /etc/openhab/backup. It is also creating the backup for openhab.

rm /etc/openhab/backup/db/*
influxd backup -portable /etc/openhab/backup/db
rm /etc/openhab/backup/openhab/*
openhab-cli backup
mv /var/lib/openhab/backups/*.zip /etc/openhab/backup/openhab
systemctl stop grafana-server.service
rm /etc/openhab/backup/grafana/*
cp -a /var/lib/grafana/grafana.db /etc/openhab/backup/grafana
cp -a /etc/grafana/grafana.ini /etc/openhab/backup/grafana
systemctl start grafana-server.service
chown -R openhab.openhab /etc/openhab/backup
chmod -R 777 /etc/openhab/backup

The second script mounts /etc/openhab from the old machine and restores the data from /mnt/backup:

#Vorbereitung

umount /mnt
mount -t cifs -o user=kn,password=xxxxxxx,uid=1000,gid=1000  //oldopenhab.xxxx.yyy/openHAB-conf /mnt/
service openhab stop

#InfluxDB

apt -y purge --auto-remove influxdb
apt install influxdb  
influxd restore -portable /mnt/backup/db


#Grafana

systemctl stop grafana-server.service
cp -a /mnt/backup/grafana/grafana.ini /etc/grafana/grafana.ini
chmod 750 /etc/grafana/grafana.ini
chown grafana.grafana /etc/grafana/grafana.ini
cp -a /mnt/backup/grafana/grafana.db /var/lib/grafana/grafana.db
chmod 750 /var/lib/grafana/grafana.db
chown grafana.grafana /var/lib/grafana/grafana.db
systemctl start grafana-server.service


#OpenHAB

openhab-cli restore /mnt/backup/openhab/open*
service openhab start

Perhaps this helps