{"id":7810,"date":"2021-05-12T14:53:28","date_gmt":"2021-05-12T19:53:28","guid":{"rendered":"https:\/\/www.rushworth.us\/lisa\/?p=7810"},"modified":"2021-05-12T14:53:28","modified_gmt":"2021-05-12T19:53:28","slug":"troubleshooting-kafka","status":"publish","type":"post","link":"https:\/\/www.rushworth.us\/lisa\/?p=7810","title":{"rendered":"Troubleshooting Kafka"},"content":{"rendered":"<p>Our server metrics are fed into a Kafka bus, and various applications are able to pick up and process this data. Problem is, however, that everything I&#8217;m sending doesn&#8217;t end up in the downstream system. The conflunce_kafka module I&#8217;m using in python reports that data is send along it&#8217;s merry way, but the primary system that is used to present metrics to end users says they&#8217;re not <em>consistently<\/em> getting data across the channel. Not never like there&#8217;s something outright wrong, but long periods of time where there&#8217;s no data followed by a cycle where data shows up.<\/p>\n<p>I&#8217;ve exhausted all of the in-script debugging I can &#8212; the messages <em>are<\/em> getting there. But I wondered if the async nature of Kafka might mean that the client&#8217;s &#8220;it got there&#8221; wouldn&#8217;t actually mean something arrived. So I had to figure out how to test a Kafka server the same way I test my MQTT server &#8212; how do I use a quick command line program to send a message and how do I use a quick command line program to subscribe to various topics.<\/p>\n<p>Turns out this is easier than anticipated &#8212; the binary build of Kafka includes windows batch files. Download the <a href=\"http:\/\/kafka.apache.org\/downloads.html\" target=\"_blank\" rel=\"noopener\">latest Kafka binary<\/a>. Untar\/unzip it somewhere. This is easy if you have the <a href=\"http:\/\/gnuwin32.sourceforge.net\/packages\/coreutils.htm\" target=\"_blank\" rel=\"noopener\">Win32 port of the GNU utilities<\/a> and can just run &#8220;tar vxfz kafka_2.13-2.8.0.tgz&#8221;.<\/p>\n<p>In the .\\kafka&lt;version&gt;\\bin\\windows folder, there are kafka-console-consumer.bat and kafka-console-producer.bat files that can be used for testing Kafka. You can open two command prompts &#8212; one for the producer (sending data to Kafka) and one for the consumer (watching Kafka for new messages). In the consumer window, run<\/p>\n<p>kafka-console-consumer.bat &#8211;bootstrap-server <em>yourkafkaserver.example.com:Port <\/em>&#8211;topic Test<\/p>\n<p>Then, in the producer, run<\/p>\n<p>kafka-console-producer.bat &#8211;broker-list <em>yourkafkaserver.example.com:Port <\/em>&#8211;topic Test<\/p>\n<p>The producer will bring you to a &#8220;&gt;&#8221; prompt where you can type some strings and hit enter to send the message to Kafka. You should see the messages pop into the consumer window.<\/p>\n<p><a href=\"https:\/\/www.rushworth.us\/lisa\/?attachment_id=7812\" rel=\"attachment wp-att-7812\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-7812\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/05\/TestingKafka-1024x693.png\" alt=\"\" width=\"960\" height=\"650\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/05\/TestingKafka-1024x693.png 1024w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/05\/TestingKafka-300x203.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/05\/TestingKafka-768x520.png 768w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/05\/TestingKafka-750x508.png 750w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/05\/TestingKafka.png 1516w\" sizes=\"auto, (max-width: 960px) 100vw, 960px\" \/><\/a><\/p>\n<p>To subscribe to multiple topics, use &#8220;&#8211;whitelist&#8221; followed by a pipe-bar delimited list of topics.<\/p>\n<p><a href=\"https:\/\/www.rushworth.us\/lisa\/?attachment_id=7811\" rel=\"attachment wp-att-7811\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-7811\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/05\/KafkaSubscribeMultipleTopics.png\" alt=\"\" width=\"981\" height=\"81\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/05\/KafkaSubscribeMultipleTopics.png 981w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/05\/KafkaSubscribeMultipleTopics-300x25.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/05\/KafkaSubscribeMultipleTopics-768x63.png 768w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/05\/KafkaSubscribeMultipleTopics-750x62.png 750w\" sizes=\"auto, (max-width: 981px) 100vw, 981px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Our server metrics are fed into a Kafka bus, and various applications are able to pick up and process this data. Problem is, however, that everything I&#8217;m sending doesn&#8217;t end up in the downstream system. The conflunce_kafka module I&#8217;m using in python reports that data is send along it&#8217;s merry way, but the primary system &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[29],"tags":[1362,1361],"class_list":["post-7810","post","type-post","status-publish","format-standard","hentry","category-technology","tag-apache-kafka","tag-kafka"],"_links":{"self":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/7810","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7810"}],"version-history":[{"count":1,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/7810\/revisions"}],"predecessor-version":[{"id":7813,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/7810\/revisions\/7813"}],"wp:attachment":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7810"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7810"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7810"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}