我正在尝试根据这篇文章在docker上实现apache kafkahttps://medium.com/simform-engineering/set-up-kafka-ecosystem-on-local-machine-1a00a436c0ba.
我已经更改了 yml 撰写文件,因此我所描述的端口已正确绑定
.YML 撰写文件
version: '3'
services:
zookeeper:
image: wurstmeister/zookeeper
container_name: zookeeper
ports:
- "2181:2181"
environment:
ZOO_MY_ID: 1
kafka:
image: wurstmeister/kafka
container_name: kafka
ports:
- "9092:9092"
environment:
KAFKA_ADVERTISED_HOST_NAME: 192.168.0.1
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
kafka_manager:
image: kafkamanager/kafka-manager
container_name: kafka-manager
restart: always
ports:
- "9000:9000"
environment:
ZK_HOSTS: "zookeeper:2181"
APPLICATION_SECRET: "random-secret"
当我启动容器时,我无法创建集群,因为我收到此错误:KeeperErrorCode = Unimplemented for /kafka-manager/mutex。我设法用这篇文章修复了这个错误KeeperErrorCode = Unimplemented for /kafka-manager/mutex
现在我看到了我的集群中的集群
但是当我按 MyFirstCluster(见上图)时。我收到以下错误
Yikes! Ask timed out on [ActorSelection[Anchor(akka://kafka-manager-system/), Path(/user/kafka-manager/MyFirstCluster/kafka-state)]] after [2000 ms]. Message of type [kafka.manager.model.ActorModel$KSGetBrokers$] was sent by [Actor[akka://kafka-manager-system/user/kafka-manager/MyFirstCluster#-549568985]]. A typical reason for `AskTimeoutException` is that the recipient actor didn't send a reply.
这是我尝试过的:
你能帮我解决这个错误吗?
出现此问题的原因可能是您的 Zookeeper 主机使用 localhost:2181。当容器尝试在 Docker 集群内进行通信时,您应该使用服务名称而不是 localhost。这允许容器解析集群内的正确网络地址。 在此输入图片描述