I'm trying to run some experiments with InfluxDB in my local machine but for some reason, auth
is not working (or I'm not being able to make it work).
I create a docker network running:
docker network create --driver bridge influxdb-telegraf-net
Later, I simply bind the 8086
of the container to the localhost's, attach a volume for the data files, and that's pretty much all:
docker run -d --name=influxdb -p 8086:8086 -v /tmp/influx:/root/.influxdb2 --net=influxdb-telegraf-net influxdb:2.0
Then, I run the following command to set up InfluxDB inside of the container:
docker exec -it influxdb influx setup
And I fill the username, password, organization... and so on.
However, when I'm "done" with the set up, I use my local influx client to create a new database, but every command I run returns: ERR: received status code 401 from server
.
For instance:
myuser@mymachine:~$ influx
Connected to http://localhost:8086 version 2.0.9
InfluxDB shell version: 1.6.7~rc0
> show databases
ERR: received status code 401 from server
I'm not sure where the issue comes from. I tried running auth
but after filling the username and password, it still returns the same error.
I'm sure it has to be some small - yet simple - detail, because I'm not doing anything fancy.
TIA!
EDIT
When running docker inspect influxdb-telegraf-net
:
myuser@mymachine:~$ docker inspect influxdb-telegraf-net
[
{
"Name": "influxdb-telegraf-net",
"Id": "33afd698984c851c86e36e083522acfac5310a87313691c047826adb073a6065",
"Created": "2022-06-25T10:15:06.630948524 01:00",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": {},
"Config": [
{
"Subnet": "172.20.0.0/16",
"Gateway": "172.20.0.1"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {
"e1ddbd36321b798a9343b3061d73ab438d012859134f73b7d072027729694917": {
"Name": "influxdb",
"EndpointID": "08e5698c04ea2532de6880946ed90c7c80e274b8920f4ce560b7c63f4a4f0f7a",
"MacAddress": "00:00:aa:00:00:00",
"IPv4Address": "172.20.0.2/16",
"IPv6Address": ""
}
},
"Options": {},
"Labels": {}
}
]
Note that I changed my MacAddress
to a dummy add just in case.
CodePudding user response:
Alright, after checking the versions (first thing I should have done!) I found out:
myuser@mymachine:~$ /usr/bin/influx --version
InfluxDB shell version: 1.6.7~rc0
and
myuser@mymachine:~$ docker exec -it influxdb /bin/bash
root@e1ddbd36321b:/# influx version
Influx CLI 2.0.9 (git: d1233b7951) build_date: 2021-10-01T21:09:53Z
So yeah, that's basically the issue. The versions of the client and the DB must match.
Keep in mind that InfluxDB 2.0 or greater does not have the out-of-the-box CLI that lets you enter the DB cli. You need to compile it by yourself as per issue #19986.