Openhab data can be easily transferred to a new openhabian installation. Running sudo openhabian-config
and using the build in backup/restore function makes the migration super simple. This does not backup/ restore influxdb though. I will try to explain how this can be easily achieved in this article.
Let’s say you managed to create a new openhabian sd card with all your openhab config data transferred. Great! Let’s start here.
Create backup of the data: I would suggest creating a folder first where the data is stored and then run the backup command:
mkdir backup_folder
# Create a backup in the portable format
influxd backup -portable /home/openhabian/backup_folder
https://docs.influxdata.com/influxdb/v1.8/administration/backup_and_restore/
Now you should have alot of files in there. To transfer it to your computer, zip it:
zip -r backup_folder.zip
Now transfer the file to your computer with scp. I would suggest logging out of ssh and transfer the file from there:
scp openhabian@IP:/home/openhabian/backup_folder.zip ./
Now copy this file to the new openhabian:
scp backup_folder.zip openhabian@IP:/home/openhabian/backup_folder.zip
# Unzip it
unzip backup_folder.zip
Now lets run
sudo openhabian-config
Install and configure Influxdb there. It seems the easiest solution. It is important to create an admin user and the user for openhab. In my case it was “admin” and “openhab”. If it creates a new database, that is not a problem.
Now let’s login to the database:
influx -username "admin" -password "openhabian"
#check if the database is there:
show databases
# if openhab is there delete it
drop database openhab
exit
Now we have it almost! Just important our backup:
influxd restore -portable /home/openhabian/backup_folder
Almost! We need to change the rights to our user:
influx -username "admin" -password "openhabian"
grant all on "openhab" to "openhab"
And that’s it!
I’m interested if anybody get’s this far