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

Not quite related but I am now going down the rPI path too (moving oh3 from debian instance on a nas to a raspberry pi 4 with oh4 and I do not want to re-create my things/items/pages etc. Any pointers on documents you found to accomplish this would be great.

See the thread about moving to RPi 4 and updating to OH4: Openhab3 buster x86 -> raspberry pi bullseye+, how?

Additional information: Started with RPi4 2 G. This did not allow influxdb to start with the version mentioned above. I removed that and installed influxdb from the distribution. This way I could get the system up and running. So I moved the data over. I found out, however, that the system was not very responsive. Openhab sometimes took up to 30 minutes to startup completely. I read somewhere that influxdb/grafana require quite a lot of memory so I ordered an RPi4 8G, which I installed yesterday. Now Openhab boots much faster compared to the 2G version.

Hope that helps

Thanks Martin - I did the move to the Xute Pi4 with 4G it wasn’t super smooth, had to relink all my itach devices, and of course (by the breaking changes in release notes) had to resave every rule.

Move summary -

  1. order pi4 and 2x 128gb High Endurance microSD cards
  2. build the pi box (screws, heatsinks, fan, do not powerup)
  3. take a backup of my oh3.2 system. (from linux: sudo openhab-cli backup )
  4. Image the microsd card with openhabian via PC (software from https://www.raspberrypi.com/software/)
    5.insert microsd card and power up Pi4 (no keyboard or display required), boot and install took about 10mins
  5. access via browser: openhabian and there it was.
  6. get the mac address of the openhabian pi4 box (windows cmd prompt,
    ping openhabian to get the ip,
    then do arp -l and look for the ip in the list, youll see the mac address beside it)
  7. Set your router dhcp to reserve this address, so the ip of the pi4 doesn’t change.
  8. ssh (windows has ssh or you can use putty) to the pi4 box
  9. copy the backup file to the pi4 box (you can CIFS mount or copy via usb stick)
  10. run this: sudo openhabian-config to see the tools on pi4 and restore the zip file
    13 change password of openhabian account on the pi4
    estimated time to this point 1hr.

And then it was pretty much running except for any rules and any itach devices all that took another 6 hours.

I am finding it sluggish to respond, more so than the NAS container. Will be looking for how to optimize.

Hope this helps anyone migrating (moving from) nas to raspberry pi.