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.

https://docs.influxdata.com/influxdb/v2.0/backup-restore/backup/

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