【问题标题】:Connect Conduktor to Kafka Docker container将 Conduktor 连接到 Kafka Docker 容器
【发布时间】:2020-11-02 01:29:29
【问题描述】:

我需要一个用于测试的小型 kafka 设置。

我是 kafka 的新手,我找不到连接到我在 docker 容器中设置的 kafka 的方法:

我尝试使用https://hub.docker.com/r/spotify/kafka/,这是一个包含zookeeper和kafka的容器,但我不知道kafka的ip是什么:

docker run -p 2181:2181 -p 9092:9092 --env ADVERTISED_HOST=`docker-machine ip \`docker-machine active\`` --env ADVERTISED_PORT=9092 spotify/kafka

日志:

Digest: sha256:cf8f8f760b48a07fb99df24fab8201ec8b647634751e842b67103a25a388981b
Status: Downloaded newer image for spotify/kafka:latest
/usr/lib/python2.7/dist-packages/supervisor/options.py:296: 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.
  'Supervisord is running as root and it is searching '
2020-07-12 19:45:07,018 CRIT Supervisor running as root (no user in config file)
2020-07-12 19:45:07,019 WARN Included extra file "/etc/supervisor/conf.d/kafka.conf" during parsing
2020-07-12 19:45:07,019 WARN Included extra file "/etc/supervisor/conf.d/zookeeper.conf" during parsing
2020-07-12 19:45:07,027 INFO RPC interface 'supervisor' initialized
2020-07-12 19:45:07,027 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2020-07-12 19:45:07,027 INFO supervisord started with pid 1
2020-07-12 19:45:08,031 INFO spawned: 'zookeeper' with pid 8
2020-07-12 19:45:08,034 INFO spawned: 'kafka' with pid 9
2020-07-12 19:45:09,081 INFO success: zookeeper entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2020-07-12 19:45:09,082 INFO success: kafka entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

我正在使用 kafka-ui 连接到它。我正在尝试使用:

zookeeper: localhost:2181   <--- working

kafka: localhost:9092 <--- ERROR: "The broker [localhost:9092] is reachable
 but Kafka can't connect. ensure you have access to the *advertised listeners* 
 of the cluster and the proper authorizations."

【问题讨论】:

  • 你在使用 Docker 工具箱吗? docker-machine ip 命令中的 docker-machine ip 命令将为您提供访问 Kafka 或任何其他容器的 IP 地址。如果没有,那么您根本不需要运行任何 docker-machine 命令。

标签: macos docker apache-kafka


【解决方案1】:

不再维护 Spotify 容器。

我建议您遵循 Confluent Docker 快速入门指南或至少使用 Docker Compose 而不是任何一体式 Kafka+ZooKeeper 映像


我还会向你指出蓝色的帮助内容,上面写着“还是 Docker?”

但是我不知道kafka的ip是什么:

它和 Zookeeper 的 IP 相同,因为你在这里只使用一个主机


看来您使用的是 Linux,所以不清楚为什么需要 Docker Machine

【讨论】:

    猜你喜欢
    • 2020-05-25
    • 2021-06-17
    • 2020-02-09
    • 2020-01-30
    • 2019-10-23
    • 2022-01-12
    • 2017-11-10
    • 2022-11-01
    • 2017-05-19
    相关资源
    最近更新 更多