influxdata / influxdb

Scalable datastore for metrics, events, and real-time analytics
https://influxdata.com
Apache License 2.0
28.59k stars 3.54k forks source link

ERR: received status code 401 from server #23137

Open rwb196884 opened 2 years ago

rwb196884 commented 2 years ago

Just installed and it doesn't work.

mini31 # apt-get install influxdb2 influxdb-client
Reading package lists... Done
Building dependency tree
Reading state information... Done
influxdb-client is already the newest version (1.6.4-1+deb10u1).
The following NEW packages will be installed:
  influxdb2 influxdb2-cli
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/114 MB of archives.
After this operation, 195 MB of additional disk space will be used.
Selecting previously unselected package influxdb2.
(Reading database ... 117705 files and directories currently installed.)
Preparing to unpack .../influxdb2_2.1.1_amd64.deb ...
Unpacking influxdb2 (2.1.1) ...
Preparing to unpack .../influxdb2-cli_2.2.1_amd64.deb ...
Unpacking influxdb2-cli (2.2.1) ...
dpkg: error processing archive /var/cache/apt/archives/influxdb2-cli_2.2.1_amd64.deb (--unpack):
 trying to overwrite '/usr/bin/influx', which is also in package influxdb-client 1.6.4-1+deb10u1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/influxdb2-cli_2.2.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
mini31 # apt-get install influxdb2 influxdb-client
Reading package lists... Done
Building dependency tree
Reading state information... Done
influxdb-client is already the newest version (1.6.4-1+deb10u1).
influxdb2 is already the newest version (2.1.1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up influxdb2 (2.1.1) ...
Created symlink /etc/systemd/system/influxd.service → /lib/systemd/system/influxdb.service.
Created symlink /etc/systemd/system/multi-user.target.wants/influxdb.service → /lib/systemd/system/influxdb.service.
mini31 # apt-get install influxdb2 influxdb-client
Reading package lists... Done
Building dependency tree
Reading state information... Done
influxdb-client is already the newest version (1.6.4-1+deb10u1).
influxdb2 is already the newest version (2.1.1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
mini31 # systemctl status influxdb
● 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 Mon 2022-02-21 09:29:08 GMT; 6min ago
     Docs: https://docs.influxdata.com/influxdb/
 Main PID: 19911 (influxd)
    Tasks: 8 (limit: 4367)
   Memory: 65.4M
   CGroup: /system.slice/influxdb.service
           └─19911 /usr/bin/influxd

Feb 21 09:29:07 mini31 influxd-systemd-start.sh[19910]: ts=2022-02-21T09:29:07.691497Z lvl=info msg="Open store (end)" l
Feb 21 09:29:07 mini31 influxd-systemd-start.sh[19910]: ts=2022-02-21T09:29:07.691529Z lvl=info msg="Starting retention
Feb 21 09:29:07 mini31 influxd-systemd-start.sh[19910]: ts=2022-02-21T09:29:07.691554Z lvl=info msg="Starting precreatio
Feb 21 09:29:07 mini31 influxd-systemd-start.sh[19910]: ts=2022-02-21T09:29:07.691621Z lvl=info msg="Starting query cont
Feb 21 09:29:07 mini31 influxd-systemd-start.sh[19910]: ts=2022-02-21T09:29:07.694681Z lvl=info msg="Configuring InfluxQ
Feb 21 09:29:07 mini31 influxd-systemd-start.sh[19910]: InfluxDB API at http://localhost:8086/ready unavailable after 1
Feb 21 09:29:08 mini31 influxd-systemd-start.sh[19910]: ts=2022-02-21T09:29:08.009652Z lvl=info msg=Starting log_id=0Znu
Feb 21 09:29:08 mini31 influxd-systemd-start.sh[19910]: ts=2022-02-21T09:29:08.010925Z lvl=info msg=Listening log_id=0Zn
Feb 21 09:29:08 mini31 influxd-systemd-start.sh[19910]: InfluxDB started
Feb 21 09:29:08 mini31 systemd[1]: Started InfluxDB is an open-source, distributed, time series database.
mini31 # influx
Connected to http://localhost:8086 version 2.1.1
InfluxDB shell version: 1.6.4
> SHOW DATABASES
ERR: received status code 401 from server
rwb196884 commented 2 years ago

OK, so influx-client seems to be for v1 and is incompatible with package influxdb which contains its own client which works completely differently -- and which won't connect at all.

rwb196884 commented 2 years ago

How do you get the influx command to do anything? I just want to SHOW DATABASES to prove that the thing is running and can be conencted to.

mini31 # influx ping
OK
mini31 # influx query 'SHOW DATABASES'
Error: must specify org ID or org name
harvey56 commented 1 year ago

You may have found an answer since, but have you configured the influx CLI ? You need to install it, then configure it with the following command :

influx config create --config-name <config-name> \
  --host-url http://localhost:8086 \
  --org <your-org> \
  --token <your-auth-token> \
  --active

More details here : https://docs.influxdata.com/influxdb/v2.6/tools/influx-cli/?t=Linux

If you want to see databases the way you put it, you can do :

influx v1 shell
show databases

v2 works differently

alihitman99 commented 4 months ago

I also encountered the same problem. and i found my problem. before we get started we should Enable Authentication for influxDB. nano /etc/influxdb/influxdb.conf auth-enabled = true systemctl restart influxdb