Linux下kafka “踩坑”记录--kafka.ZooKeeperClientTimeoutException: Timed out waiting for connection while in

kafka默认端口号9092,但是ZooKeeper默认端口号是2181
如图错误:
Linux下kafka “踩坑”记录--kafka.ZooKeeperClientTimeoutException: Timed out waiting for connection while in_第1张图片
Linux下kafka “踩坑”记录--kafka.ZooKeeperClientTimeoutException: Timed out waiting for connection while in_第2张图片
创建和更改主题分区时报错:
kafka.zookeeper.ZooKeeperClientTimeoutException: Timed out waiting for connection while in state: CONNECTING

查看配置文件server.properties中的ZK部分发现,ZK默认端口号指定是2181
Linux下kafka “踩坑”记录--kafka.ZooKeeperClientTimeoutException: Timed out waiting for connection while in_第3张图片
然而我把kafka的默认端口号9092当成ZK的去用,所以报错,新手问题。。。
将端口号修改回来后,就OK了。
如下例子,将test主题分区号修改为5个:

llw@ubuntu:/opt/kafka_2.12-2.4.0$ sudo ./bin/kafka-topics.sh --alter  --zookeeper localhost:2181  --topic test  --partitions 5
WARNING: If partitions are increased for a topic that has a key, the partition logic or ordering of the messages will be affected
Adding partitions succeeded!

查看结果:
Linux下kafka “踩坑”记录--kafka.ZooKeeperClientTimeoutException: Timed out waiting for connection while in_第4张图片

你可能感兴趣的:(kafka,time,out)