command-line-interfaceinfluxdb

InfluxDB CLI 401 Unauthorized


$ dpkg --print-architecture
amd64
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.6 LTS
Release:        18.04
Codename:       bionic

Installed InfluxDB according to the manual

Installed InfluxDB CLI according to the manual

Made the initial configuration in InfluxBD UI(http://localhost:8086/) by setting user, password and operator token.

$ influx version

Influx CLI 2.5.0 (git: 3285a03) build_date: 2022-11-01T16:32:06Z

Provide required authentication credentials.

influx config create --config-name default \
  --host-url http://localhost:8086 \
  --org myInitialOrg \
  --token myOperatorToken \
  --active

  Active  Name    URL                     Org
*       default http://localhost:8086   myInitialOrg
$ influx config
Active  Name    URL                     Org
*       default http://localhost:8086   myInitialOrg

Next, I get a 401 response code for almost all commands:

$ influx user list
Error: failed to list users: 401 Unauthorized: unauthorized access
$ influx auth list
Error: could not find authorization with given parameters: 401 Unauthorized: unauthorized access
$ influx org list
Error: failed to list orgs: 401 Unauthorized: unauthorized access
$ influx dashboards
Error: failed to find dashboards: 401 Unauthorized: unauthorized access

...

Here are the configuration files + logs + server status:

$ nano ~/.influxdbv2/configs

[default]
  url = "http://localhost:8086"
  token = "myOperatorToken"
  org = "myInitialOrg"
  active = true
# 
# [eu-central]
#   url = "https://eu-central-1-1.aws.cloud2.influxdata.com"
#   token = "XXX"
#   org = ""
# 
# [us-central]
#   url = "https://us-central1-1.gcp.cloud2.influxdata.com"
#   token = "XXX"
#   org = ""
# 
# [us-west]
#   url = "https://us-west-2-1.aws.cloud2.influxdata.com"
#   token = "XXX"
#   org = ""

$ nano /etc/influxdb/config.toml

bolt-path = "/var/lib/influxdb/influxd.bolt"
engine-path = "/var/lib/influxdb/engine"

$ cd /var/log/influxdb/
$ ls -al

total 8
drwxr-xr-x  2 influxdb influxdb 4096 гру  8 21:16 .
drwxrwxr-x 22 root     syslog   4096 гру  8 21:16 ..

$ service influxdb status
● influxdb.service - InfluxDB is an open-source, distributed, time series database
   Loaded: loaded (/lib/systemd/system/influxdb.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2022-12-08 22:15:52 EET; 31min ago
     Docs: https://docs.influxdata.com/influxdb/
  Process: 31456 ExecStart=/usr/lib/influxdb/scripts/influxd-systemd-start.sh (code=exited, status=0/SUCCESS)
 Main PID: 31459 (influxd)
    Tasks: 10 (limit: 4915)
   CGroup: /system.slice/influxdb.service
           └─31459 /usr/bin/influxd

influxd-systemd-start.sh[31456]: ts=2022-12-08T20:46:06.013581Z lvl=info msg=Unauthorized log_id=0edqvnil000 error="authorization not found"

When I want to create an all access token through InfluxDB CLI, it does not see the organization created through InfluxBD UI:

$ influx auth create \
>   --all-access \
>   --host http://localhost:8086 \
>   --org myInitialOrg \
>   --token myOperatorToken
Error: failed to lookup org with name "myInitialOrg": 401 Unauthorized: unauthorized access

I can create organizations, buckets and such in InfluxBD UI, but I can't do almost anything in CLI. :( I understand that there is some kind of mess with user rights, but I don't understand where to look for the reason.

I tested installation InfluxBD under root and under a normal user. After starting the daemon, I get an authorization error:

~$ influxd
2022-12-13T07:44:19.829656Z     info    Welcome to InfluxDB     {"log_id": "0ejbuoTG000", "version": "v2.5.1", "commit": "5b6fdbf05d", "build_date": "2022-11-02T18:06:28Z", "log_level": "info"}
2022-12-13T07:44:19.852907Z     info    Resources opened        {"log_id": "0ejbuoTG000", "service": "bolt", "path": "/home/sergey/.influxdbv2/influxd.bolt"}
2022-12-13T07:44:19.853282Z     info    Resources opened        {"log_id": "0ejbuoTG000", "service": "sqlite", "path": "/home/sergey/.influxdbv2/influxd.sqlite"}
2022-12-13T07:44:19.854955Z     info    Bringing up metadata migrations {"log_id": "0ejbuoTG000", "service": "KV migrations", "migration_count": 20}
2022-12-13T07:44:20.053738Z     info    Bringing up metadata migrations {"log_id": "0ejbuoTG000", "service": "SQL migrations", "migration_count": 8}
2022-12-13T07:44:20.214786Z     info    Using data dir  {"log_id": "0ejbuoTG000", "service": "storage-engine", "service": "store", "path": "/home/sergey/.influxdbv2/engine/data"}
2022-12-13T07:44:20.215516Z     info    Compaction settings     {"log_id": "0ejbuoTG000", "service": "storage-engine", "service": "store", "max_concurrent_compactions": 2, "throughput_bytes_per_second": 50331648, "throughput_bytes_per_second_burst": 50331648}
2022-12-13T07:44:20.215630Z     info    Open store (start)      {"log_id": "0ejbuoTG000", "service": "storage-engine", "service": "store", "op_name": "tsdb_open", "op_event": "start"}
2022-12-13T07:44:20.216077Z     info    Open store (end)        {"log_id": "0ejbuoTG000", "service": "storage-engine", "service": "store", "op_name": "tsdb_open", "op_event": "end", "op_elapsed": "0.455ms"}
2022-12-13T07:44:20.216250Z     info    Starting retention policy enforcement service   {"log_id": "0ejbuoTG000", "service": "retention", "check_interval": "30m"}
2022-12-13T07:44:20.216327Z     info    Starting precreation service    {"log_id": "0ejbuoTG000", "service": "shard-precreation", "check_interval": "10m", "advance_period": "30m"}
2022-12-13T07:44:20.221739Z     info    Starting query controller       {"log_id": "0ejbuoTG000", "service": "storage-reads", "concurrency_quota": 1024, "initial_memory_bytes_quota_per_query": 9223372036854775807, "memory_bytes_quota_per_query": 9223372036854775807, "max_memory_bytes": 0, "queue_size": 1024}
2022-12-13T07:44:20.236566Z     info    Configuring InfluxQL statement executor (zeros indicate unlimited).     {"log_id": "0ejbuoTG000", "max_select_point": 0, "max_select_series": 0, "max_select_buckets": 0}
2022-12-13T07:44:20.247538Z     info    Starting        {"log_id": "0ejbuoTG000", "service": "telemetry", "interval": "8h"}
2022-12-13T07:44:20.247735Z     info    Listening       {"log_id": "0ejbuoTG000", "service": "tcp-listener", "transport": "http", "addr": ":8086", "port": 8086}
2022-12-13T07:44:27.087602Z     info    Unauthorized    {"log_id": "0ejbuoTG000", "error": "authorization not found"}
2022-12-13T07:44:37.085461Z     info    Unauthorized    {"log_id": "0ejbuoTG000", "error": "authorization not found"}
2022-12-13T07:44:47.086652Z     info    Unauthorized    {"log_id": "0ejbuoTG000", "error": "authorization not found"}
2022-12-13T07:44:57.088191Z     info    Unauthorized    {"log_id": "0ejbuoTG000", "error": "authorization not found"}
2022-12-13T07:45:07.092043Z     info    Unauthorized    {"log_id": "0ejbuoTG000", "error": "authorization not found"}

Through the web interface(InfluxBD UI), I created a initial user + operator token + initial organization + initial bucket. Commands using the operator token also give an authorization error:

~$ influx user list -t web-token
Error: failed to list users: 401 Unauthorized: unauthorized access
~$ influx auth list -t web-token
Error: could not find authorization with given parameters: 401 Unauthorized: unauthorized access
~$ influx auth list -u web-user -t "web-token"
Error: could not find authorization with given parameters: 401 Unauthorized: unauthorized access

Solution

  • I understand that this is not a completely correct answer for the situation, but it solved the problem in general. After switching to Ubuntu 20.04.6 LTS, absolutely all problems were solved. Aggressive decision :(