Running "influx bucket update -i <your-bucket-id> --retention 0" but getting 401 unauthorised

Two Questions:

First:

I am running influxdb:2.6.1 and am trying to update a bucket’s retention to “never” as I wish to keep the data in the long term (more than 1 year)

I am running influxdb in a docker container

I am using the container console to type the influx update command - but am getting a 401 error. I have no idea why or how to fix this. Can anyone help?

Second Question. I am using a few custom scripts to push data into several influxdb buckets from different devices. (Synology NAS, TrueNAS as well as using Home Assistant (into which I also import data)). I didn’t write the scripts in the first place, but have modified them as things change. I set this container up a while ago and hadn’t realised I was using a specific version of influxdb that I suspect has long vanished. I am using Grafana to collect data from influxdb

Am I safe to upgrade (and to what version). I am using Grafana-enterprise:latest. I don’t want to lose the existing data or have to redo Grafana

For 401 error, check to ensure the bucket ID is correct and the token is an All Access token for your org and is actually being used by the CLI invocation

Bucket ID is correct - I initially used the bucket name - which was wrong

How to I make the command use the token?

@NugentS You just need to include the -t, --token flag with your command. Use it to pass your API token. For example:

influx bucket update -t <your-api-token> -i <your-bucket-id> --retention 0

@scott Thank you - I shall give that a tryinflux bucket -h

1 Like