$ 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
按照手册
安装了InfluxDB根据手册
安装了InfluxDB CLI通过设置用户、密码和操作员令牌在 InfluxBD UI(http://localhost:8086/) 中进行初始配置。
$ influx version
Influx CLI 2.5.0 (git: 3285a03) build_date: 2022-11-01T16:32:06Z
提供所需的身份验证凭据。
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
接下来,我收到几乎所有命令的 401 响应代码:
$ 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
...
以下是配置文件+日志+服务器状态:
$ 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"
当我想通过 InfluxDB CLI 创建所有访问令牌时,它看不到通过 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
我可以在 InfluxBD UI 中创建组织、存储桶等,但在 CLI 中几乎无法执行任何操作。 :( 我知道用户权限存在某种混乱,但我不明白在哪里寻找原因。
我在 root 和普通用户下测试了安装 InfluxBD。 启动守护进程后,我收到授权错误:
~$ 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"}
通过Web界面(InfluxBD UI),我创建了一个初始用户+操作员令牌+初始组织+初始存储桶。 使用操作员令牌的命令也会给出授权错误:
~$ 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
我知道这不是针对这种情况的完全正确的答案,但它总体上解决了问题。切换到
Ubuntu 20.04.6 LTS
之后,绝对所有问题都解决了。激进的决定:(
我遇到了同样的问题,找到了解决方法。并不完美,但就我而言,我确信该令牌是有效的,因为我在 python 脚本中使用它......
influx config update -n $CONFIG_NAME --username-password $YOUR_USER
所以下次你什么时候打电话:
influx auth list
Cli 会询问您的用户密码...