database "telegraf" creation failed: Post "http://influxdb:8086/query": dial tcp 172.31.0.2:8086: connect: connection refused

5k views Asked by At

I installed four containers in my ec2 instance and every container is running fine. One of the containers in Telegraf and another one in influxdb. So I am trying to write the data from Telegraf to Influxdb and in Telegraf is coming from the AWS Kinesis. So after everything up and running data from kinesis is coming to the Telegraf but from telegraf data is not coming to Influxdb.

Here what I have changed in telegraf.conf file for getting data from Influxdb.

[[outputs.influxdb]]
urls = [“influxdb:8086”]
#urls = [“http://localhost:8086”]
database = “telegraf”

This is a snippet from my docker-compose.yml file.

influxdb:
  image: influxdb:1.8.2
  container_name: influxdb
  restart: always
  ports:
    - 8086:8086
  networks:
    - analytics
  volumes:
    - /mnt/db/:/mnt/db/
    - /mnt/influx/:/mnt/influx/
    - ./etc/influxdb/influxdb.conf:/etc/influxdb/influxdb.conf
telegraf:
image: telegraf
container_name: telegraf     
restart: always
depends_on:
  - influxdb
networks:
  - analytics
volumes:
  - telegraf-storage:/var/lib/telegraf
  - ./etc/telegraf/telegraf.conf:/etc/telegraf/telegraf.conf    
environment:                            
  INFLUXDB_URL: http://influxdb:8086   
  # - username=admin
  # - password=admin
links:
    - influxdb    

This is the error, I am getting. I checked port is also listening. Data is also coming in Telegraf from Kinesis.

[outputs.influxdb] When writing to [http://influxdb:8086]: database "telegraf" creation failed: Post "http://influxdb:8086/query": dial tcp 172.31.0.2:8086: connect: connection refused
0

There are 0 answers