kafka | Error: Cannot open an HTTP server: socket.error reported errno.ENOENT (2)

kafka | Error: Cannot open an HTTP server: socket.error reported errno.ENOENT (2)

我正在尝试 运行 多个容器使用 docker-compose 与以下配置:

version: "2.1"
services:
    # Kafka/Zookeeper container
  kafka:
    build: kafka/
    container_name: kafka
    environment:
      - ADVERTISED_HOST=localhost
      - LOG_RETENTION_HOURS=1
      - AUTO_CREATE_TOPICS=false
      - KAFKA_CREATE_TOPICS=divolte:4:1
    ports:
      - 9092:9092 # kafka broker
      - 2181:2181 # Zookeeper
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
  # Divolte container
  divolte:
    image: divolte/divolte-collector
    container_name: divolte
    environment:
      - DIVOLTE_KAFKA_BROKER_LIST=localhost:9092
    volumes:
      - ./conf/divolte/:/opt/divolte/divolte-collector/conf/
    ports:
      - 8290:8290
    depends_on:
      - kafka
    links:
      - kafka:kafka

我每次都会收到以下错误。其他一切似乎都正常。

kafka       | 2020-03-27 21:46:33,260 CRIT Supervisor is running as root.  Privileges were not dropped because no user is specified in the config file.  If you intend to run as root, you can set user=root in the config file to avoid this message.
kafka       | 2020-03-27 21:46:33,260 INFO Included extra file "/etc/supervisord.d/initialize.ini" during parsing
kafka       | 2020-03-27 21:46:33,260 INFO Included extra file "/etc/supervisord.d/kafka.ini" during parsing
kafka       | 2020-03-27 21:46:33,260 INFO Included extra file "/etc/supervisord.d/zookeeper.ini" during parsing
kafka       | /usr/lib/python3.6/site-packages/supervisor/options.py:471: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security.
kafka       |   'Supervisord is running as root and it is searching '
kafka       | Error: Cannot open an HTTP server: socket.error reported errno.ENOENT (2)
kafka       | For help, use /usr/bin/supervisord -h

顺便说一句,我正在尝试从这个网站进行测试: https://godatadriven.com/blog/real-time-analytics-divolte-kafka-druid-superset/

我一直在尝试修复它但没有成功(尝试更改权限和目录)

感谢您的帮助。

这永远行不通。

- DIVOLTE_KAFKA_BROKER_LIST=localhost:9092

您是在告诉 divolte 容器指向 自身 。它至少应该是 kafka:9092。并且您必须更改 Kafka 容器的 ADVERTISED_HOST 以通告 它的主机名

  kafka:
    build: kafka/
    container_name: kafka
    hostname: kafka  # added
    environment:
      - ADVERTISED_HOST=kafka  # changed
      - LOG_RETENTION_HOURS=1
      - AUTO_CREATE_TOPICS=false
      - KAFKA_CREATE_TOPICS=divolte:4:1
    ports:
      - 9092:9092 # kafka broker
      - 2181:2181 # Zookeeper

查看答案 -

另外 - 为了方便起见,尽量不要 运行 Zookeper 和 Kafka 在同一个图像中。当它们分开时效果更好。