Hi all,
I have an influxDB installation with UI on windows
Now I’m trying to run CLI commands on the same instance.
So, I downloaded the influx CLI and placed it in the same folder as Influxd.
Next, I followed this guide to create a configuration file by filling in the parameters as follows:
–config-name, I entered the name “login”
–host-url, “http://localhost:8086”
–org the organization, used by my user in the UI
–token, I generated an API token in the “API TOKENS” page setting it as “All Acces”
–active, to make it active
But now whatever command I run the message that is shown is the following.
Hi everyone,
I unlocked my situation with this solution
Instead of logging in with a token I used the credentials I usually use in the GUI.
I know it’s not really a solution, but it worked out for me.
Here is the easier solution as I was experiencing the same 401 error when invoking “influx” on the CLI, I found a better way to change the Token value. The “influx” cmd is tied to the original token as mentioned above, but if you created a new operator || all-access token or deleted the original token, here is the approach to fix it.
check if you have nano installed or some editor, if not $apt-get update && apt-get nano
$cd /etc/influxdb2
this is where you will find the influxdb config file called “influx-configs”
now, $influx auth list
this will reveal the Token for all the respective users, find the User who has an Operator || All-Access Token, and copy it (I did it with an Operator Token, I think All-Access should work too, as long as you use the -organization flag value that All Access token has access to)
then $nano influx-configs, make sure you are in the directory of /etc/influxdb2, if not add path to the nano command
you will see the original token in the token key/value pair in the influx-configs file
shift+ins to paste the copied Operator token, and remove the original Token value, save file
invoke some $influx command, and you should not see the 401 error anymore
This removes the need to reinstall or spin up a new Docker container for influx
p/s: if you are not using Docker, just locate go directly to /etc/influxdb2 on your machine or vm with the same steps