OpenMarine
transfer influx data from the boat to a server - Printable Version

+- OpenMarine (https://forum.openmarine.net)
+-- Forum: OpenPlotter (https://forum.openmarine.net/forumdisplay.php?fid=1)
+--- Forum: How I did it (https://forum.openmarine.net/forumdisplay.php?fid=6)
+--- Thread: transfer influx data from the boat to a server (/showthread.php?tid=4405)



transfer influx data from the boat to a server - tobias.e - 2023-01-05

So I am running openplotter with influxdb on my boat, and was looking for a way to transfer data from influxdb on the boat to another influxdb on a computer at home. 

Since the boat is only connected to the internet at some times, all "official" influxdb methods i found are not feasible.

I installed termux (basically a mini Linux environment) on my Android phone, and inside termux i installed openssh and rsync, and deployed the ssh key to openplotter for passwordless login:

Code:
pkg upgrade
pkg install openssh rsync
ssh-keygen
cat .ssh/id_rsa.pb | ssh pi@openplotter "cat - >> .ssh/authorized_keys"

On openplotter i added the user pi to the group influxdb and made sure that he can read all contents of /var/lib/influxdb 

Code:
sudo su -
cd /var/lib/influxdb
chmod -R g+r *
for i in `find -type d`; do chmod g+x $i; done

Now, whenever i am on the boat, i can connect my phone to the open plotter wifi and use rsync in termux on my phone to get a snapshot of the influx database.

Code:
rsync -a pi@openplotter:/var/lib/influxdb transfer
 
On my home server, i set up a dedicated influxdb server, and when i am back home, i just stop the server, use a similar rsync command to drop the data from my phone and restart it.

Rsync is fairly efficient for this job, as it only transfers new files and changes in files, but does not copy unchanged files.

Of course there would be a shortcut, if either openplotter or my home server could be reached from the internet ( e.g. using remote.it)  Wink