MacBook-Pro:kafka_2.11-1.0.0 pan$ bin/kafka-topics.sh --describe --zookeeper localhost:2182 --topic my-replicated-topic
Topic:my-replicated-topic PartitionCount:8 ReplicationFactor:3 Configs:
Topic: my-replicated-topic Partition: 0 Leader: 1 Replicas: 1,2,0 Isr: 1,2
Topic: my-replicated-topic Partition: 1 Leader: 2 Replicas: 2,0,1 Isr: 2,1
Topic: my-replicated-topic Partition: 2 Leader: 1 Replicas: 0,1,2 Isr: 1,2
Topic: my-replicated-topic Partition: 3 Leader: 1 Replicas: 1,0,2 Isr: 1,2
Topic: my-replicated-topic Partition: 4 Leader: 2 Replicas: 2,1,0 Isr: 2,1
Topic: my-replicated-topic Partition: 5 Leader: 2 Replicas: 0,2,1 Isr: 2,1
Topic: my-replicated-topic Partition: 6 Leader: 1 Replicas: 1,2,0 Isr: 1,2
Topic: my-replicated-topic Partition: 7 Leader: 2 Replicas: 2,0,1 Isr: 2,1
brokder0 已经被杀掉,但是无法消费,启动broker0又可以恢复消费。生产消息不受影响。咋回事呢?
这个问题有解码?
求大神指点,说好的高可用,这是咋了?
https://www.orchome.com/805
排查过程和解决办法写在这里了
单杀broker1 或者单broker2 都不影响生产和消费,唯独broker0不能杀
你的描述里,没有leader是0的呀?
broker0已经被我kill了,这是重新选举之后的状态了
然后在这个状态下,不能消费,生产可以。
持续一段时间能消费么?要有一段时间重新平衡的。
一直都不能消费,只要broker0挂掉,就不能消费,其他broker怎么挂都可以。
自动平衡过程 我看到了,包括broker的controller选举,在zookeeper中(get /controller )也看到变更成功了,我现在集群开4个broker,也是一样效果。
真是不知道咋回事broker0偏偏不能挂
这是我的消费客户端代码
/* 自动提交偏移量 */ public void autoCommit(){ Properties props = new Properties(); props.put("bootstrap.servers", "127.0.0.1:9091,127.0.0.1:9092,127.0.0.1:9093,127.0.0.1:9099"); props.put("group.id", "testGroup"); props.put("enable.auto.commit", "true"); props.put("auto.commit.interval.ms", "1000"); props.put("key.deserializer", "org.apache.kafka.common.serialization.StringDeserializer"); props.put("value.deserializer", "org.apache.kafka.common.serialization.StringDeserializer"); KafkaConsumer<String, String> consumer = new KafkaConsumer<>(props); consumer.subscribe(Arrays.asList("my-replicated-topic")); while (true) { ConsumerRecords<String, String> records = consumer.poll(100); for (ConsumerRecord<String, String> record : records){ System.out.printf("offset = %d, key = %s, value = %s%n", record.offset(), record.key(), record.value()); System.out.println("record.toString() = " + record.toString()); } } }
9099 broker0 -- 就是这个神奇的broker
9091 broker1
9092 broker2
...类推
https://www.orchome.com/805
排查过程和解决办法写在这里了
你的答案