@airvb the influx backup and influx restore commands use the server’s API to download/upload data, so you’ll need to leave the server running to use them.
If you’re willing to stop the DB as part of the moving process, I’d instead recommend a simpler approach:
Stop the DB
Use cp or mv to relocate your /home/airvb/.influxdbv2 to /media/influxdbv2
Edit your config file to point at the new location
Start the DB
Once you’ve verified things are working, delete the old directory (if you used cp instead of mv)
No, you’ll need to restart the DB at some point for the config-change to be picked up, and I don’t think it’s safe to cp the files from under a running DB since it bypasses in-process locks and the cache.
You could try backing up from your current server and restoring into a new instance, configured to store data at the new paths. The downside of this would be that you’ll miss out on any new data written after you’ve taken the backup.
Thanks for this. Followed your process successfully on a Raspberry Pi influxdb after wasting too much time on search results for moving v1.x influxdb databases.
The only small hitch was the systemd scripts in /usr/lib/influxdb/scripts. They want to see a .PID file in the /var/lib/influxdb folder. I guess that I could edit the script but I was lazy so just left an empty /var/lib/influxdb for the scripts to use
uid 116 and 123 is the uid and gid of influxdb on the local machine. One would expect this would work but no.
Jul 25 15:50:46 orangepi3-lts systemd[1]: influxdb.service: Scheduled restart job, restart counter is at 4.
Jul 25 15:50:46 orangepi3-lts systemd[1]: Stopped InfluxDB is an open-source, distributed, time series database.
Jul 25 15:50:46 orangepi3-lts systemd[1]: Starting InfluxDB is an open-source, distributed, time series database...
Jul 25 15:50:46 orangepi3-lts influxd-systemd-start.sh[142549]: /usr/lib/influxdb/scripts/influxd-systemd-start.sh: line 5: /var/lib/influxdb/influxd.pid: Permission denied
Jul 25 15:50:46 orangepi3-lts systemd[1]: influxdb.service: Control process exited, code=exited, status=1/FAILURE
Jul 25 15:50:46 orangepi3-lts systemd[1]: influxdb.service: Failed with result 'exit-code'.