0

我正在尝试在 docker-compose 中将 TICK-Stack 与 RabbitMQ 一起设置,但我无法将任何东西连接到 InfluxDB。无论我尝试什么,我总是会收到连接被拒绝的错误。有人可以向我解释如何设置此堆栈以使其正常工作吗?

我还看到,当我第一次创建容器时,没有创建新的数据库。官方容器有问题吗?

码头工人-compose.yml

version: '3'
services:
  rabbitmq:
    build: .
    image: mqtt-rabbitmq
    environment:
      - RABBITMQ_ERLANG_COOKIE=${RABBITMQ_ERLANG_COOKIE}
      - RABBITMQ_DEFAULT_USER=${RABBITMQ_DEFAULT_USER}
      - RABBITMQ_DEFAULT_PASS=${RABBITMQ_DEFAULT_PASS}
      - RABBITMQ_DEFAULT_VHOST=${RABBITMQ_DEFAULT_VHOST}
    ports:
      - "15672:15672"
      - "5672:5672"
      - "1883:1883"
  influxdb:
    image: influxdb:1.7-alpine
    environment:
      - AUTH_ENABLED=false
      - INFLUXDB_HTTP_AUTH_ENABLED=false
      - INFLUXDB_ADMIN_USER=telegraf
      - INFLUXDB_ADMIN_PASSWORD=telegraf
      - INFLUXDB_DB=telegraf
    volumes:
      - ./influxdb/data:/var/lib/influxdb
      - ./influxdb/config/:/etc/influxdb/
    ports:
      - "8086:8086"
      - "8082:8082"
      - "8089:8089/udp"
  telegraf:
    image: telegraf:1.11-alpine
    environment:
      HOSTNAME: "telegraf-getting-started"
    links:
      - influxdb
    volumes:
      - ./telegraf.conf:/etc/telegraf/telegraf.conf:ro
      - /var/run/docker.sock:/var/run/docker.sock
    depends_on:
      - rabbitmq
      - influxdb
  kapacitor:
    image: kapacitor:1.5-alpine
    volumes:
      - ./kapacitor/data/:/var/lib/kapacitor
      - ./kapacitor/config/:/etc/kapacitor/
    links:
      - influxdb
    ports:
      - "9092:9092"
  chronograf:
    image: chronograf:1.7-alpine
    environment:
      RESOURCES_PATH: "/usr/share/chronograf/resources"
    volumes:
      - ./chronograf/data/:/var/lib/chronograf/
    links:
      - influxdb
      - kapacitor
    ports:
      - "8888:8888"
    depends_on:
      - kapacitor
      - influxdb
      - telegraf

电报文件

[global_tags]
dc = "localhost"
[agent]
interval = "1s"
debug = true
# OUTPUTS
[[outputs.influxdb]]
url = "http://localhost:8086"
database = "telegraf"
precision = "ns"
# INPUTS
[[inputs.cpu]]
percpu = true
totalcpu = false
fielddrop = ["time_*"]
[[inputs.mqtt_consumer]]
name_prefix = "influx"
servers = ["tcp://rabbitmq:1883"]
qos = 0
connection_timeout = "30s"
topics = [
  "test",
]
persistent_session = false
client_id = ""
username = "rabbitmq"
password = "rabbitmq"
data_format = "json"
json_string_fields = ["symbol"]
4

1 回答 1

0

尝试将您的流入图像更改为以下图像

  influxdb:
    image: quay.io/influxdb/influxdb:v2.0.3
    container_name: influxdb
    restart: always
    networks:
      - monitoring
    environment:
      - INFLUXDB_DB=telegraf
      - INFLUXDB_USER=telegraf
      - INFLUXDB_ADMIN_ENABLED=true
      - INFLUXDB_ADMIN_USER=admin
      - INFLUXDB_ADMIN_PASSWORD=admin
    volumes:
      - ./influxdb/data:/var/lib/influxdb
      - ./influxdb/config/:/etc/influxdb/
    ports:
      - "8086:8086"
      - "8082:8082"
      - "8089:8089/udp"
于 2021-02-23T13:13:17.930 回答