We are running an InfluxDB 2.0 instance in a docker environment. For some weeks we have collected data using telegraf and store them into a bucket. Now, we would like to do a backup of our data.
What we can do to save our data is to make a copy of
/root/.influxdbv2/, but we prefere to use build-in features and be able to restore the data into another instance of InfluxDB 2.0. This is were the problems begin.
$ influx version Influx CLI 2.0.0-beta.13 (git: 86796ddf2d) build_date: 2020-07-09T12:15:08Z
Trying to do a backup
$ export INFLUX_TOKEN=<token of admin user> $ influx bucket find --org myOrg ID Name Retention Organization ID 05b89a36ffe01003 _monitoring 168h0m0s 05b89a36ffe01000 05b89a36ffe01002 _tasks 72h0m0s 05b89a36ffe01000 05b89a36ffe01001 myBucket 0s 05b89a36ffe01000 $ influx backup -p /backup/backup_$(date '+%Y-%m-%d_%H-%M') Error: read:dbrp is unauthorized See 'influx backup -h' for help
influx "Error: read:dbrp is unauthorized" would not find anything on the internet.
The only hint I got is from the documentation:
If you set up InfluxDB using v2.0.0-beta.1 or earlier, you cannot back up data. Root tokens created prior to v2.0.0-beta.2 do not have the necessary permissions. To succesfully use the backup tool, set up a new InfluxDB instance using v2.0.0-beta.2+.
I pretty sure we started with a later beta version, from march, but I cannot doublecheck this. However, I would like to find a solution to export our data.
Trying to add missing permissions
As it seemed we do not have the right permissions, I checked the permissions and wanted to try adding the missing permissions to my admin user, which obviously did not work.
Check current permissions
During the check for permissions, I can see, that my admin user token does not have any
dbrp permissions. But when I generate a new token in the GUI via Generate -> All access token, then the new token seems to have the required permissions:
$ influx auth list 05f79912b4f73000 <newToken> myAdmin 05b89a36e7e01000 [... read:orgs/05b89a36ffe01000/dbrp write:orgs/05b89a36ffe01000/dbrp ...]
(I shortened the output)
Error on adding permissions
However, just in case I tried to add the permissions to my admin user anyway.
$ influx auth create --user myAdmin --org myOrg --read-dbrps Error: Permission read:orgs/05b89a36ffe01000/dbrp is not allowed: read:orgs/05b89a36ffe01000/dbrp is unauthorized.
Trying the new created token
As we saw in the step above, the new token has dprp permissions. When I use this token for the backup, I receive another error message.
$ export INFLUX_TOKEN=<newToken> $ influx backup -p /backup/backup_$(date '+%Y-%m-%d_%H-%M') Error: read:authorizations is unauthorized See 'influx backup -h' for help
After reading this, I tried to set my token via the credentials file. But that did not change anything.
Migrating data to a fresh InfluxDB 2.0 instance
When I spawn a fresh Docker container of InfluxDB 2.0, the
influx backup command works as expected. So, in order to use the build-in commands, I would like to migrate the collected data from my bucket into another instance. Do you see any possibility or am I missing anything to make these commands work?
Thanks a lot.
PS: Oh, there is no
influxdb tag, at all? And I do not have enough reputation to create that tag. I hope it's the right q&a platform to ask my question?