Better way to check if connection with Kafka is working
See original GitHub issueFirst, thanks for the awesome module, it’s always helping in my projects. But I have an use case where I need to periodically check if the connection and the Kafka cluster is alive. Right now, to do this I created an auxiliary topic and that I will write a message and then try to read it to see if the Kafka cluster is running and if communication with the cluster is possible.
The problem, is that this solution is kind cumbersome, for instance I need to create and maintain an auxiliary topic, and if I’m only using KafkaProducer
I need to create an extra KafkaConsumer
just to check this, the same happens in the inverse scenario.
So would be possible to improve this use case?
Thanks
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top Results From Across the Web
How to check whether Kafka Server is running? - Stack Overflow
I would say that another easy option to check if a Kafka server is running is to create a simple KafkaConsumer pointing to...
Read more >Guide to Check if Apache Kafka Server Is Running | Baeldung
One of the quickest ways to find out if there are active brokers is by using Zookeeper's dump command. The dump command is...
Read more >Why Can't I Connect to Kafka? | Troubleshoot Connectivity
Scenario 1: Client and Kafka running on the different machines. Now let's check the connection to a Kafka broker running on another machine....
Read more >Testing a Kafka connection — brandur.org
It's occasionally useful to test a Kafka connection; for example in case you want to verify that your security groups are properly ...
Read more >Kafka Connect 101: Troubleshooting Common Issues and ...
Kafka Connect 101: Troubleshooting Common Issues and How to Debug Them ... LEARN MORE ▻ Changing the Logging Level for Kafka Connect ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This pattern seems to go against the design of Kafka I think? Producers and consumers should be decoupled.
The producer should only care about message delivery. I believe the library already takes care of this.
acks
keyword argument that sets the level of acknowledgment to None, Leader or ISR (in-sync replicas). I would think leader acknowledgement should get you a good enough guarantee that the producer has succeeded. Of course this fails if the leader dies before a follower has copied it.The consumer only cares about consuming messages which I also think the library handles in regards to connection status.
It could be beneficial to run a canary service if thats what you really care about. We have done something similar in the past where we were curious about message publishing/delivery latency and wrote a simple canary service that both publishes and consumes its own messages. You could do something similar if you just want to monitor kafka but keep in mind that you don’t need to do this for every producer/consumer, just a single instance could be doing this.
You could build a canary service for something like that, not sure it meets the requirements for this library but its also only a few lines of code. Would not be that hard to whip up. I will document how I have done it before.
Drew Kowalik
On Thu, Jul 26, 2018 at 11:39 AM, Maulik Shah notifications@github.com wrote: