我已经定义了一个kafka群集的两个节点,复制因子为2。P>
生产者
./bin/kafka-console-producer.sh --broker-list localhost:9092 --topic adi
消费者
./bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic adi --from-beginning
群集描述
运行./bin/kafka-topics.sh --describe --bootstrap-server localhost:9092 --topic adi
渲染:
Topic:adi PartitionCount:1 ReplicationFactor:2 Configs:segment.bytes=1073741824 Topic: adi Partition: 0 Leader: 3 Replicas: 3,2 Isr: 3,2
P.S 我要做的就是关注Kafka Quickstart教程。
在Kafka-Console-Consumer中也添加其他经纪人地址并进行检查。
您可能不是从领导者复制品中消耗的,请尝试
./bin/kafka-console-consumer.sh -bootstrap-server localhost:9092, 其他经纪人:其他港口 - 主题ADI-从beginning
确保您正在从同一家服务器运行prod/"消费者",最好使用服务器IP而不是localhost。