{"id":992,"date":"2021-03-01T12:01:18","date_gmt":"2021-03-01T12:01:18","guid":{"rendered":"http:\/\/www.igfasouza.com\/blog\/?p=992"},"modified":"2021-04-19T22:09:07","modified_gmt":"2021-04-19T21:09:07","slug":"kafka-at-the-edge-with-raspberry-pi","status":"publish","type":"post","link":"http:\/\/www.igfasouza.com\/blog\/kafka-at-the-edge-with-raspberry-pi\/","title":{"rendered":"kafka at the edge with Raspberry PI"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/03\/sensehat_demo-1024x489.png\" alt=\"\" class=\"alignnone size-large wp-image-993\" width=\"625\" height=\"298\" srcset=\"http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/03\/sensehat_demo-1024x489.png 1024w, http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/03\/sensehat_demo-300x143.png 300w, http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/03\/sensehat_demo-768x366.png 768w, http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/03\/sensehat_demo-624x298.png 624w\" sizes=\"auto, (max-width: 625px) 100vw, 625px\" \/><\/p>\n<p><b>How\u2019s the man?<\/b><br \/>\n<small style=\"color:#9f9f9f\">2021\/03\/01<\/small><\/p>\n<p>This is another blog about Raspberry PI, and today I want to show how I did a simple Kafka cluster demo using Sense Hat &amp; GFX Hat.<\/p>\n<p>If you&#8217;re not familiar with Kafka, I suggest you have a look at my previous post <a href=\"http:\/\/www.igfasouza.com\/blog\/what-is-kafka\/\" rel=\"noopener\" target=\"_blank\">What is Kafka?<\/a> before, and you can have a look at how I created the Kafka cluster <a href=\"http:\/\/www.igfasouza.com\/blog\/raspberry-pi-kafka-cluster\/\" rel=\"noopener\" target=\"_blank\">here<\/a>.<\/p>\n<p>The Sense HAT is an add-on board for Raspberry Pi, tha has an 8\u00d78 RGB LED matrix, a five-button joystick and includes the following sensors: Gyroscope, Accelerometer, Magnetometer, Barometer, Temperature sensor and Relative Humidity sensor.<br \/>\nYou can learn more about <a href=\"http:\/\/www.igfasouza.com\/blog\/sense-hat\/\" rel=\"noopener\" target=\"_blank\">Sense hat<\/a> in my previous blog.<\/p>\n<p>The GFX HAT is an add-on board for Raspberry Pi, tha has a 128&#215;64 pixel, 2.15&#8243; LCD display with snazzy six-zone RGB backlight and six capacitive touch buttons. GFX HAT makes an ideal display and interface for your headless Pi projects.<br \/>\nYou can learn more about GFX hat <a href=\"https:\/\/shop.pimoroni.com\/products\/gfx-hat\" rel=\"noopener\" target=\"_blank\">here<\/a> and check the API <a href=\"https:\/\/github.com\/pimoroni\/gfx-hat\" rel=\"noopener\" target=\"_blank\">here<\/a>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/03\/hats-1024x395.jpg\" alt=\"\" class=\"alignnone size-large wp-image-1000\" width=\"625\" height=\"241\" srcset=\"http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/03\/hats-1024x395.jpg 1024w, http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/03\/hats-300x116.jpg 300w, http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/03\/hats-768x296.jpg 768w, http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/03\/hats-624x241.jpg 624w, http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/03\/hats.jpg 1227w\" sizes=\"auto, (max-width: 625px) 100vw, 625px\" \/><\/p>\n<p>The idea here is to focus on scenarios where the Kafka clients and the Kafka brokers are running on the edge. This enables edge processing, integration, decoupling, low latency, and cost-efficient data processing.<\/p>\n<p><strong>Edge Kafka<\/strong> is not simply yet another IoT project using Kafka in a remote location. Edge Kafka is an essential component of a streaming nervous system that spans IoT (or OT in Industrial IoT) and non-IoT (traditional data-center \/ cloud infrastructures).<\/p>\n<blockquote><p>\nMulti-cluster and cross-data center deployments of Apache Kafka have become the norm rather than an exception. A Kafka deployment at the edge can be an independent project. However, in most cases, Kafka at the edge is part of an overall Kafka architecture.<br \/>\nApache Kafka is the New Black at the Edge in Industrial IoT, Logistics, and Retailing<\/p><\/blockquote>\n<p><a href=\"https:\/\/www.kai-waehner.de\/blog\/2020\/01\/01\/apache-kafka-edge-computing-industrial-iot-retailing-logistics\/\" rel=\"noopener\" target=\"_blank\">https:\/\/www.kai-waehner.de\/blog\/2020\/01\/01\/apache-kafka-edge-computing-industrial-iot-retailing-logistics\/<\/a><\/p>\n<h2>Idea<\/h2>\n<p>A Raspberry Pi 2 nodes Kafka cluster, with a Micronaut Kafka producer that gets sense hat data and a Quarkus Kafka consumer that puts the result in a REST that GFX Hat reads using python API.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/03\/diagran-1024x801.jpg\" alt=\"\" class=\"alignnone size-large wp-image-994\" width=\"625\" height=\"489\" srcset=\"http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/03\/diagran.jpg 1024w, http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/03\/diagran-300x235.jpg 300w, http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/03\/diagran-768x601.jpg 768w, http:\/\/www.igfasouza.com\/blog\/wp-content\/uploads\/2021\/03\/diagran-624x488.jpg 624w\" sizes=\"auto, (max-width: 625px) 100vw, 625px\" \/><\/p>\n<p>The Micronaut producer gets the Sense Hat humidity, pressure, and temperature values and sends it to a Kafka topic.<\/p>\n<p>The Quarkus consumer reads a Kafka topic and generates a REST interface with the last topic value. I used the GFX Hat to display the result.<\/p>\n<p>You can get the full Micronaut Kafka Producer code on my <a href=\"https:\/\/github.com\/igfasouza\/micronaut_sensehat\" rel=\"noopener\" target=\"_blank\">GitHub<\/a>.<br \/>\nYou can get the full Quarkusl Kafka Consumer code on my <a href=\"https:\/\/github.com\/igfasouza\/quarkus-kafka-consumer\" rel=\"noopener\" target=\"_blank\">GitHub<\/a>.<\/p>\n<p><b>Results<\/b><\/p>\n<div class=\"twitter-tweet\">\n<blockquote class=\"twitter-tweet\" data-lang=\"en\">\n<p lang=\"in\" dir=\"ltr\">A Raspberry 2 nodes Kafka cluster.<br \/>Micronaut kafka producer get sense hat data and quarkus kafka consumer put the result in a REST that GFX Hat read using python API<a href=\"https:\/\/twitter.com\/hashtag\/raspberrypi?src=hash&amp;ref_src=twsrc%5Etfw\">#raspberrypi<\/a> <a href=\"https:\/\/twitter.com\/hashtag\/raspberry?src=hash&amp;ref_src=twsrc%5Etfw\">#raspberry<\/a><a href=\"https:\/\/twitter.com\/hashtag\/sensehat?src=hash&amp;ref_src=twsrc%5Etfw\">#sensehat<\/a> <a href=\"https:\/\/twitter.com\/hashtag\/gfxhat?src=hash&amp;ref_src=twsrc%5Etfw\">#gfxhat<\/a> <a href=\"https:\/\/twitter.com\/hashtag\/Java?src=hash&amp;ref_src=twsrc%5Etfw\">#Java<\/a> <a href=\"https:\/\/twitter.com\/hashtag\/python?src=hash&amp;ref_src=twsrc%5Etfw\">#python<\/a><a href=\"https:\/\/twitter.com\/hashtag\/micronaut?src=hash&amp;ref_src=twsrc%5Etfw\">#micronaut<\/a><a href=\"https:\/\/twitter.com\/hashtag\/quarkus?src=hash&amp;ref_src=twsrc%5Etfw\">#quarkus<\/a><a href=\"https:\/\/twitter.com\/hashtag\/apachekafka?src=hash&amp;ref_src=twsrc%5Etfw\">#apachekafka<\/a> <a href=\"https:\/\/twitter.com\/hashtag\/kafka?src=hash&amp;ref_src=twsrc%5Etfw\">#kafka<\/a><a href=\"https:\/\/twitter.com\/Raspberry_Pi?ref_src=twsrc%5Etfw\">@Raspberry_Pi<\/a> <a href=\"https:\/\/t.co\/0zuohbaELd\">pic.twitter.com\/0zuohbaELd<\/a><\/p>\n<p>&mdash; Igor De Souza (@Igfasouza) <a href=\"https:\/\/twitter.com\/Igfasouza\/status\/1293514673896202240?ref_src=twsrc%5Etfw\">August 12, 2020<\/a><\/p><\/blockquote>\n<\/div>\n<p>Kafka is a great solution for the edge. It enables deploying the same open, scalable, and reliable technology at the edge, data center, and the cloud. This is relevant across industries. Kafka is used in more and more places where nobody has seen it before. Edge sites include retail stores, restaurants, cell towers, trains, and many others.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How\u2019s the man? 2021\/03\/01 This is another blog about Raspberry PI, and today I want to show how I did a simple Kafka cluster demo using Sense Hat &amp; GFX Hat. If you&#8217;re not familiar with Kafka, I suggest you&hellip; <a href=\"http:\/\/www.igfasouza.com\/blog\/kafka-at-the-edge-with-raspberry-pi\/\" class=\"more-link\">Continue Reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":993,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[17,7,13],"class_list":["post-992","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-java","tag-kafka","tag-raspberry-pi"],"_links":{"self":[{"href":"http:\/\/www.igfasouza.com\/blog\/wp-json\/wp\/v2\/posts\/992","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.igfasouza.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.igfasouza.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.igfasouza.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.igfasouza.com\/blog\/wp-json\/wp\/v2\/comments?post=992"}],"version-history":[{"count":6,"href":"http:\/\/www.igfasouza.com\/blog\/wp-json\/wp\/v2\/posts\/992\/revisions"}],"predecessor-version":[{"id":1125,"href":"http:\/\/www.igfasouza.com\/blog\/wp-json\/wp\/v2\/posts\/992\/revisions\/1125"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.igfasouza.com\/blog\/wp-json\/wp\/v2\/media\/993"}],"wp:attachment":[{"href":"http:\/\/www.igfasouza.com\/blog\/wp-json\/wp\/v2\/media?parent=992"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.igfasouza.com\/blog\/wp-json\/wp\/v2\/categories?post=992"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.igfasouza.com\/blog\/wp-json\/wp\/v2\/tags?post=992"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}