The stability of my Raspberry Pi that I use for the project Temperature Monitor is not what is should be. Sometimes it simply stops and I need to reboot the RPi to fix it, but somewhere in November a simple reboot did not work. I was able to open Grafana but it didn’t showed any new data. So I opened a ssh session only to find out that Python no longer functioned!
The same counted for some other critical functions like apt and or journalctl, but… Grafana and InflixDB still worked. The data was intact and fortunately I still had a second RPi-Zero that I had used to document the
Temperature Monitor Project. Today I found the time to move all the data from RPi to RPi.
Back-up Move and Restore
First steps. Backing up the data and moving it to the other side was surprisingly easy:
influxd backup -portable /home/pi/influxdb-bckup_20191219a rsync -avz influxdb-bckup_20191219a pi@<ipOfTheOtherRPi:/home/pi/
The second step, restoring the data was a little bit harder. The command itself is simple:
influxd restore -portable influxdb-bckup_20191219a
But unfortunately I received the error:
error updating meta: DB metadata not changed. database may already exist
restore: DB metadata not changed. database may already exist
The documentation learned that this is expected behaviour as the DB already existed in this RPi. So before I could restore it I needed to drop the DB.
influx -username admin -password <removed> Connected to http://localhost:8086 version 1.7.7 InfluxDB shell version: 1.7.7 > DROP DATABASE temperature > exit
After that I was able to restore the DB running the command above. Now if you want to merge 2 db’s together, you can do this by using a temporary db. For that I refer to the documentation page of InfluxDB
This project is far from finished. I still need to configure the backup and also move it all to a nice pcb. But on the bright side. The data is moved for a regular RPi to a zero one and the last one is using less power.