I'm setting up a multi-node Apache Kafka cluster, but it seems my Zookeeper instances are having trouble communicating with each other.
I'm deploying the cluster as a Docker Swarm stack. I'm aware that, according to Confluent's docs , networking through swarm overlay drivers is not supported. So I'm publishing the ports on all interfaces. However, my Zookeeper instances keep throwing this exception:
EndOfStreamException: Unable to read additional data from client, it probably closed the socket: address = /127.0.0.1:{some_random_port}, session = 0x100fc7d362c0002
When I try to execute zookeeper-shell localhost:12181 ls /brokers/ids
against my Zookeeper instances, it seems that some of my Zookeeper instances manage to connect to a Kafka broker or two, but the instances are not aware of the brokers connected to other Zookeeper instances.
Here's my partial setup:
x-zookeeper-envs: &zookeeper-envs
ZOOKEEPER_TICK_TIME: 2000
ZOOKEEPER_SERVER_1: zookeeper-1:12888:13888;12181
ZOOKEEPER_SERVER_2: zookeeper-2:22888:23888;22181
ZOOKEEPER_SERVER_3: zookeeper-3:32888:33888;32181
services:
zookeeper-1:
image: confluentinc/cp-zookeeper:7.1.1
<<: *network
ports:
- 12181:12181
- 12888:2888
- 13888:3888
deploy:
placement:
constraints: [node.labels.worker==1]
environment:
<<: *zookeeper-envs
ZOOKEEPER_CLIENT_PORT: 12181
ZOOKEEPER_SERVER_ID: 1
zookeeper-2:
image: confluentinc/cp-zookeeper:7.1.1
<<: *network
ports:
- 22181:22181
- 22888:2888
- 23888:3888
deploy:
placement:
constraints: [node.labels.worker==2]
environment:
<<: *zookeeper-envs
ZOOKEEPER_CLIENT_PORT: 22181
ZOOKEEPER_SERVER_ID: 2
zookeeper-3:
image: confluentinc/cp-zookeeper:7.1.1
<<: *network
ports:
- 32181:32181
- 32888:2888
- 33888:3888
deploy:
placement:
constraints: [node.labels.worker==3]
environment:
<<: *zookeeper-envs
ZOOKEEPER_CLIENT_PORT: 32181
ZOOKEEPER_SERVER_ID: 3
I have also tried setting the Zookeeper environment variables in this format: ZOOKEEPER_SERVER_1: zookeeper-1:12888:13888::1;12181
, but to no avail.
1条答案
按热度按时间64jmpszr1#
我设法让它运行使用
zookeeper
图像而不是confluentinc/cp-zookeeper
。这里是我的设置,以防有人在Swarm上设置多节点Zookeeper/Kafka。