I am trying to use the command: influxd backup -portable influxdb_data_backup/
I am running this command from the terminal of ubuntu as my home user, “spvirt1”
I have the following file permission for the directory influxdb_data_backup/
spvirt1@spvirt1:/mnt/virt_drive$ ls -l
total 24
drwxrwxr-x 2 influxdb influxdb 4096 Apr 17 08:32 influxdb_data
drwxrwxr-x 2 influxdb influxdb 4096 Apr 17 08:33 influxdb_data_backup
drwx------ 2 root root 16384 Apr 17 00:07 lost+found
I am getting this error however:
spvirt1@spvirt1:/mnt/virt_drive$ influxd backup -portable influxdb_data_backup/
2019/04/17 09:09:18 backing up metastore to influxdb_data_backup/meta.00
backup: open temp file: open influxdb_data_backup/meta.00.pending: permission denied
Right now my data is all in the default directory and I was going to first back it up into this new folder and then switch the data directory from the default to my new “influxdb_data” folder. I appear to be having file permission problems. I don’t believe I should have to use sudo for this? Should I be running the command from within influxdb? I am just running it directly from the Ubuntu terminal.
I guess I should add that I am trying to do this with influxdb still running, but as I understand that should not be a problem.
Also, my mount point is from an ext4 formatted drive I have auto mounted using fstab. I read a similar issue, here: Influx will not start if data directory changed - #2 by jeff
but I believe I already have my permission set correctly all the way back to the mount point:
spvirt1@spvirt1:/mnt$ ls -l
total 4
drwxrwxr-x 5 influxdb influxdb 4096 Apr 17 09:45 virt_drive
Hi Mark,
So you are saying instead of running the following command as my home user “spvirt1” I should run it as “influxdb”. Is there a default password, because I actually cannot switch to influxdb user without a password and I do not remember ever specifying one. Here is the command I run as the “spvirt1” user
If you backup with another user , that user needs permissions on the backup location,
In your situation you could chmod 777 on the backup location to solve your permission problems or add your user to the Influxdb group …
Ok, I got it to work using: sudo -u influxdb influxd backup -portable influxdb_data_backup/
So, just to be clear then, when I run the command “influxd”, it is running as whatever user I am currently logged in as? It does not automagically switch to the “influxdb” user? Using sudo -u influxdb however should use influxdb as the user as you mentioned.
I am now about to try switching my data directory. As I mentioned above, all my ownership is “influxdb”, so I should be ok to change my config file, correct?
I did the backup as we already covered. Then I modified the ‘meta’ and ‘data’ directories in my config file. I then restarted influxdb. I then used the restore command: