0
votes

I have a java consumer connecting to kafka cluster(3 brokers) using broker1:9092. Then client will receive the metadata containing the brokers in the cluster and it will connect to any one of them. What happens if the broker1 itself is down, which is used by my consumer to connect and get the metadata info. How do i resolve this kind of scenario.

Can i point my java consumer to all the broker IPs and port ?

1

1 Answers

0
votes

Can i point my java consumer to all the broker IPs and port ?

Yes, you can do that. Actually, that is why the configuration name is called bootstrap.servers with an "s" at the end.

According to the JavaDocs on the KafkaConsumer you can provide a comma-seperated list of one or more of your brokers:

"The connection to the cluster is bootstrapped by specifying a list of one or more brokers to contact using the configuration >bootstrap.servers. This list is just used to discover the rest of the brokers in the cluster and need not be an exhaustive list of servers in the cluster (though you may want to specify more than one in case there are servers down when the client is connecting)."