Home > Blockchain >  Problems setting up a docker based InfluxDB/Grafana network
Problems setting up a docker based InfluxDB/Grafana network

Time:09-29

My intention is to use Windows Docker to deploy an InfluxDB 2.0.8 database and link to it via a self-hosted Grafana instance on the same docker network.

To do so, I've done the below steps:

  1. Start the network, InfluxDB and Grafana via below:
docker network create influxdb
docker run -d --net=influxdb --name=grafana -p 3000:3000 grafana/grafana
docker run -d --net=influxdb --name=influxdb -p 8086:8086 --volume C:/influxdb:/var/lib/influxdb2 influxdb:2.0.8
  1. Open http://localhost:8086 to set up the basics. Via the InfluxDB UI get the below details:
  • Org ID (from the About page)
  • Token (from the Token page, using the already generated one)
  • Default bucket (the bucket I created)
  • URL (http://localhost:8086)
  1. I then go to Grafana via localhost:3000 and add an InfluxDB data storage (Flux) and enter the above details. However, when I test it, I get an "Error reading InfluxDB". In the console, I get the below error:
POST http://localhost:3000/api/ds/query 400 (Bad Request)
{refId: 'test', message: 'Post "http://localhost:8086/api/v2/query?org=35e0f…l tcp 127.0.0.1:8086: connect: connection refused'}

Any idea what might be missing in the above?

CodePudding user response:

I think another way to access influx from grafana would be accessing it from container name: setup influxdb data source as: influxdb:8086

CodePudding user response:

  1. Run command docker network inspect influxdb. There you can find IP in Gateway and use it.

  2. Or use by your container name:

http://influxdb:8086/...

Also I recommend read Official Documentation about Docker network communications.

  • Related