I have a cluster of Zookeeper (version-3.4.13) containing 3 nodes and a cluster of Kafka (version-2.11-2.1.0) containing 2 nodes. I am using Spring Kafka version-2.1.9.RELEASE to set up Producers/Consumers.
I am running a 2 node cluster of my spring boot application, having consumers of a particular topic. If I stop both the Kafka nodes and then starts only one of them (which possibly do not acts as 'Group Coordinator'), then consumers stops consuming messages from the queue (even after one Kafka node is up and running) until I restart my Spring Boot Application.
Didn't found much resources on this issue. Need to understand the cause of this, where Kafka cluster goes down and then if one of the nodes is started (perhaps should elect the leader automatically).
Below is my consumer configuration:
Map<String, Object> properties = new HashMap<>();
properties.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, kafkaServerUrl + ":" + kafkaServerPort +
(StringUtils.isEmpty(additionalBrokers)?"":","+additionalBrokers));
properties.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
properties.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, JsonDeserializer.class);
properties.put(ConsumerConfig.GROUP_ID_CONFIG, "testGroup");
properties.put(JsonDeserializer.TRUSTED_PACKAGES, "com.test.model");
properties.put(JsonDeserializer.VALUE_DEFAULT_TYPE,"com.test.EMailConfig");
I expect that the consumers should start consuming the messages again when only one of the Kafka cluster nodes is started again.
Did anyone came across such issue? Please post your recommendations.
Below is the screen shot of the output from describe command when 1 broker is stopped: enter image description here
Thanks in advance.
$ kafka-topics.sh --bootstrap-server localhost:9092 --describe --topic myTopic
. – Gary Russell