Influxdb2.0 backup authentication issue

I’m new to InfluxDB and have V2 running in a docker container successfully for a few days. I’d like to back up my data but I’m struggling to understand what the output is telling me.

I run the following inside the docker container:

influx backup -t [my_token] -o [my_org_name] /var/lib/influxdb/backup

The output of this is:

2021-01-16T10:22:31.585015Z     info    Backing up KV store     {"log_id": "0RjgKdd0000", "path": "20210116T102231Z.bolt"}
Error: Read:authorizations is unauthorized.
See 'influx backup -h' for help

I see that a directory /var/lib/influxdb/backup is created which contains one empty .bolt file:

-rw-r--r-- 1 root root    0 Jan 16 10:22 20210116T102231Z.bolt

The docs that I’ve read aren’t very clear on how authorisation works other than providing a token. The token I’ve used is an ‘all-access’ token for my org.

Using CLI version: Influx CLI 2.0.3 (git: fe04d346df) build_date: 2020-12-15T01:00:16Z
DB version: Version 2.0.3 (fe04d34)

Can anyone help me understand what my issue is?

Hello @tanc ,
Hmm that’s odd I. would expect that to work. Are you using the root authorization token the token created for the first user in the InfluxDB setup process?

Thanks for responding @Anaisdg . It turns out this was a newbie error, I had installed Influxdb 2.0 but mistakenly followed a guide for using 1.8 in Docker and had bind mounted the wrong directory. It turns out my bolt file and associated databases were all in the container’s /root/.influxdbv2 directory and I was querying against what was possibly an old an empty db from a previous 1.8 install.

Anyway, all good now!

1 Like

Hello @tanc ,
Happy to hear it! :slight_smile:

Hi @tanc

Could you elaborate on the fix?

I am using influxdb:2.0 following the 2.0 guide and get the same issue you have posted above.

Thanks,
Anish

@anishpq I don’t think I can elaborate more than I did. I was using the wrong bolt file. Once I pointed to the correct one it worked.

@Anaisdg @tanc
I am trying to backup influxdb using backup command as stated in v2.0 doc.

docker-compose.yaml

version: '3'
services:
  influxdb:
    image: influxdb:2.0
    ports:
      - 8086:8086
    volumes:
      - influxdb-data:/var/lib/influxdb2
      - /influxdb-backup/:/influxdb-backup/
    restart: always

volumes:
  influxdb-data:
    external: true

The Backup Commmand fails as follow.

docker-compose exec influxdb influx backup influxdb-backup -t xxx 
2021-04-22T22:14:06.631863Z info    Backing up KV store {"log_id": "0TfvCY9G000", "path": "20210422T221406Z.bolt"} 
Error: Read:authorizations is unauthorized. 
See 'influx backup -h' for help

Dear, I checked all my installing process, I don’t remember there’s step to create the " root authorization token", also can not find in the help, could you give some clear explaination or how re-create it?

1 Like

It looks like there has not been any response to this. I am in the same situation. Recently I had to re-install my influx, and I did not node down my root authorization token. Does it mean that it is all lost now and there is no way of retrieving it? And my influx database is useless from now on?

@nygma2004 If you are able to get to your bolt file you can find the API key for the root user there. Made the same mistake and was able to get backups working once I snagged the API key from that file.

@ThatNaysayer oh cool that is great news. Yes, I can get to my bolt file. How can I retrieve the key from it?

you should be able to find your username in the file then look for the api key afterwards. if you search for “key” in the file you should be able to narrow it down - they all end with a “==”
so look for that shortly after your username.

1 Like