I’m running InfluxDB in a docker container on my server. The problem is, all of the files (database files) created in /var/lib/infludb have very restrictive permissions (-rwx------).
root@9df4d0ab807a:/var/lib/influxdb/data# ls -l
total 1
drwx------ 4 root root 4 May 28 21:38 _internal
drwx------ 4 root root 4 May 28 21:41 home_assistant
The problem with this is that it is non-trivial to write any sort of backup script without giving it root permissions.
Is there a way to get influxdb to write the database files with broader permission? I’ve exhausted my Google-fu (umask, file permissions, …) and have not found an answer.
Stupid question: why would you want to backup a databse relying on filesystem access? Why not simply leverage its own tools to create a stable backup and include that into your scripts?
Hi @Juggler , I had the same problem. Can you give a little detail on how you did the backup in the end, without changing the file permissions? @CaptainCrunch says “leverage its own tools” and “include that into your scripts”. What does it refer to exactly?
Hi @Juggler , Thank you for providing this, it is very helpful. Forgive my inexperience, but when you say “running on the host machine”, do you mean you have somehow set it up to run periodically?
Yes. I have setup a cron job to run the script I included every evening. I’m running HA and InfluxDB in Docker containers, which is why the script looks the way it does.