Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kapacitor 401 unautherized #76

Open
Mair opened this issue Feb 28, 2021 · 10 comments
Open

Kapacitor 401 unautherized #76

Mair opened this issue Feb 28, 2021 · 10 comments

Comments

@Mair
Copy link

Mair commented Feb 28, 2021

Hi,

I'm trying to follow the getting started documentation. I followed the instructions and ran ./sandbox up
the web site start up OK but then when navigating to the "Hosts Lists" I get an "Unable to get hosts error"

Looking at the containers I see sandbox_kapacitor_1 has stopped.
looking at the logs I see the following

2021/02/28 23:26:25 Using configuration at: /etc/kapacitor/kapacitor.conf
ts=2021-02-28T23:26:25.666Z lvl=info msg="kapacitor starting" service=run version=1.5.8 branch=HEAD commit=873d93b7377bf1c7bfbcd508e4ea6a6213997aff
ts=2021-02-28T23:26:25.666Z lvl=info msg="go version" service=run version=go1.15.5
ts=2021-02-28T23:26:25.666Z lvl=info msg="listing Kapacitor hostname" source=srv hostname=a727262bc6f9
ts=2021-02-28T23:26:25.670Z lvl=info msg="listing ClusterID and ServerID" source=srv cluster_id=cd642cef-dbc1-4d4b-901d-6a4bb6b5f67d server_id=3dcab9b5-011c-40aa-bc28-f7243de239fc
ts=2021-02-28T23:26:25.670Z lvl=info msg="opened task master" service=kapacitor task_master=main
ts=2021-02-28T23:26:25.677Z lvl=error msg="failed to connect to InfluxDB, retrying..." service=influxdb cluster=default err="Get \"http://influxdb:8086/ping\": dial tcp 172.20.0.3:8086: connect: connection refused"
ts=2021-02-28T23:26:26.340Z lvl=error msg="failed to connect to InfluxDB, retrying..." service=influxdb cluster=default err="Get \"http://influxdb:8086/ping\": dial tcp 172.20.0.3:8086: connect: connection refused"
ts=2021-02-28T23:26:26.904Z lvl=error msg="failed to connect to InfluxDB, retrying..." service=influxdb cluster=default err="Get \"http://influxdb:8086/ping\": dial tcp 172.20.0.3:8086: connect: connection refused"
ts=2021-02-28T23:26:27.783Z lvl=error msg="failed to connect to InfluxDB, retrying..." service=influxdb cluster=default err="Get \"http://influxdb:8086/ping\": dial tcp 172.20.0.3:8086: connect: connection refused"
ts=2021-02-28T23:26:30.239Z lvl=info msg="closed HTTP service" service=http
ts=2021-02-28T23:26:30.239Z lvl=info msg="closed HTTP service" service=http
ts=2021-02-28T23:26:30.239Z lvl=info msg="closed task master" service=kapacitor task_master=main
ts=2021-02-28T23:26:30.239Z lvl=error msg="encountered error" service=run err="open server: open service *influxdb.Service: failed to link subscription on startup: invalid response: code 401: body: {\"code\":\"unauthorized\",\"message\":\"unauthorized access\"}"

run: open server: open service *influxdb.Service: failed to link subscription on startup: invalid response: code 401: body: {"code":"unauthorized","message":"unauthorized access"}
@gazon1
Copy link

gazon1 commented Mar 1, 2021

Hi!

What version of influxdb are you using? The sandbox is not working with influxdb of version greater or equal 2.

Check also that .env file doesn't have:

TELEGRAF_TAG=telegraf:latest
INFLUXDB_TAG=influxdb:latest
CHRONOGRAF_TAG=chronograf:latest
KAPACITOR_TAG=kapacitor:latest

You should have something like:

TELEGRAF_TAG=telegraf:latest
INFLUXDB_TAG=influxdb:1.8
CHRONOGRAF_TAG=chronograf:latest
KAPACITOR_TAG=kapacitor:latest

@Mair
Copy link
Author

Mair commented Mar 1, 2021

Thanks @gazon1,
This is a clean git pull off the repo following the instructions at get-started for the docker environment.
I can confirm the .env file to be as

TELEGRAF_TAG=telegraf:latest
INFLUXDB_TAG=influxdb:1.8
CHRONOGRAF_TAG=chronograf:latest
KAPACITOR_TAG=kapacitor:latest

@gazon1
Copy link

gazon1 commented Mar 1, 2021

Try to set up a user in influxdb in docker compose
The error says, that you're not authorised. Initially, influxdb has no users and so it couldn't connect

services:
  influxdb:
    # Full tag list: https://hub.docker.com/r/library/influxdb/tags/
    build:
      context: ./images/influxdb/
      dockerfile: ./${TYPE}/Dockerfile
      args:
        INFLUXDB_TAG: ${INFLUXDB_TAG}
    image: "influxdb"
    volumes:
      # Mount for influxdb data directory
      - ./influxdb/data:/var/lib/influxdb
      # Mount for influxdb configuration
      - ./influxdb/config/:/etc/influxdb/
    ports:
      # The API for InfluxDB is served on port 8086
      - "8086:8086"
      - "8082:8082"
      # UDP Port
      - "8089:8089/udp"
    environment:
      DOCKER_INFLUXDB_INIT_MODE: setup
      DOCKER_INFLUXDB_INIT_USERNAME: login
      DOCKER_INFLUXDB_INIT_PASSWORD: password
      DOCKER_INFLUXDB_INIT_ORG: org
      DOCKER_INFLUXDB_INIT_BUCKET: bucker
      DOCKER_INFLUXDB_INIT_ADMIN_TOKEN: amdintoken
...

@Mair
Copy link
Author

Mair commented Mar 1, 2021

@gazon1 Tried that, same error although is you look at the log before that it says dial tcp 172.22.0.3:8086: connect: connection refused
I have checked, there is nothing else on that port

@gazon1
Copy link

gazon1 commented Mar 1, 2021

Just found, that these command (DOCKER_INFLUXDB_...) in docker dompose may not be correct. Sometimes it doesn't create a user and database in influxdb. So try also to enter influxdb ./sandbox enter influxdb and initiate a user influx setup

But in this case, we should run a docker with kapacitor after setting up a influxdb user. So we should stop using docker compose

@gazon1
Copy link

gazon1 commented Mar 1, 2021

So my guess is to check that you're running influxdb v < 2.0. Somehow, greater versions could be installed via docker cashe. I have no problems with version 1.8
You can ./sandbox enter influxdb and check version of influx there

@Mair
Copy link
Author

Mair commented Mar 1, 2021

No That's not it, It is 1.8. I find it disheartening that Its not working out of the box. The idea is to get a system up and running quickly so I can learn the technology, Now it seems I have to be an expert debugger before I can start to learn it. Its docker compose!... It should work the same in every environment

@Mair
Copy link
Author

Mair commented Mar 3, 2021

Tried this on a colleagues machine who also uses windows 10. Same result

@jmoeyersons
Copy link

Change this in your docker-compose file:

image: "influxdb:1.8" (add the :1.8)

This fixed my issue

@AminSaqi
Copy link

Also, change this in sandbox.bat file:

SET INFLUXDB_TAG=latest

to this:

SET INFLUXDB_TAG=1.8

You should remove created influxdb images, too. Even if it is tagged as influxdb:1.8. Finally, run sandbox up again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants