Kafka
Author: s | 2025-04-24
Kafka 0.9 Consumer Rewrite Design; Kafka 0.9 Unit and Integration Tests; KAFKA-656 - Quota Design; Kafka API Refactoring; Kafka APIs; Kafka Authorizations (ACLs) Kafka Client Jars Upgrade; Kafka Command Line and Related Improvements; Kafka Controller Internals; Kafka Controller Redesign; Kafka data structures in Zookeeper; Kafka Enriched
Kafka Introduction, Kafka Architecture, Kafka Use
Allow the data path between the client and listener.Info about the route resource can be found here.We are going to configure one service for initial load balancing and then one service and one route per broker.ConfigurationInitial balancing Service and RouteService Name: kafka-svcRoute Name: kafka-routeBroker1# Kubernetes SettingsPod name: kafka-broker-0Service name: kafka-broker-0-svcRoute name: kafka-broker-0-route# Kafka settingslister.security.protocol.map: CLIENT:SSL, BROKER:SSL, EXTERNAL:SSLinter.broker.listener.name: BROKERlisteners: CLIENT://:9091, BROKER://:9092, EXTERNAL://:9093 advertised.listeners: CLIENT://kafka-broker-0.kafka.svc.kafka.cluster.local:9091 BROKER://kafka-broker-0:9092, EXTERNAL://kafka-broker-0.apps.ocp4.example.com:443Broker2# Kubernetes SettingsPod name: kafka-broker-1Service name: kafka-broker-1-svcRoute name: kafka-broker-1-route# Kafka settingslister.security.protocol.map: CLIENT:SSL, BROKER:SSL, EXTERNAL:SSLinter.broker.listener.name: BROKERlisteners: CLIENT://:9091, BROKER://:9092, EXTERNAL://:9093advertised.listeners: CLIENT://kafka-broker-1.kafka.svc.kafka.cluster.local:9091 BROKER://kafka-broker-1:9092, EXTERNAL://kafka-broker-1.apps.ocp4.example.com:443Broker3# Kubernetes SettingsPod name: kafka-broker-2Service name: kafka-broker-2-svcRoute name: kafka-broker-2-route# Kafka settingslister.security.protocol.map: CLIENT:SSL, BROKER:SSL, EXTERNAL:SSLinter.broker.listener.name: BROKERlisteners: CLIENT://:9091, BROKER://:9092, EXTERNAL://:9093advertised.listeners: CLIENT://kafka-broker-2.kafka.svc.kafka.cluster.local:9091 BROKER://kafka-broker-2:9092, EXTERNAL://kafka-broker-2.apps.ocp4.example.com:443Using the services FQDN ensures that pods from all namespaces can resolve the service hostname. The pod running the client receives the address kafka-broker-0.kafka.svc.kafka.cluster.local which resolves to the broker pods IP address.TopologyExternal Client ConnectionSummaryConfiguring listeners and advertised listeners can take a bit of time to get your head around, particularly the difference between the settings. Gaining an understanding of these configuration options will help simplify designing a Kafka architecture for client connectivity.Page logo image source: Kafka 0.9 Consumer Rewrite Design; Kafka 0.9 Unit and Integration Tests; KAFKA-656 - Quota Design; Kafka API Refactoring; Kafka APIs; Kafka Authorizations (ACLs) Kafka Client Jars Upgrade; Kafka Command Line and Related Improvements; Kafka Controller Internals; Kafka Controller Redesign; Kafka data structures in Zookeeper; Kafka Enriched Apache Kafka Event Streaming Install Config Kafka on Windows Setup Kafka on Mac Install Kafka on Ubuntu Kafka with Docker Compose Checking Kafka Version Run Kafka on Custom Ports Uninstall Kafka Completely Apache Kafka Practical Cheat Sheet Apache Kafka: Topics Partitions Create Manage Kafka Topics Kafka: List and Inspect Topics Kafka is complex. Removing Zookeeper simplifies Kafka’s security model.[CTA_MODULE]ZooKeeper mode vs. KRaft modeKRaft is a consensus protocol that simplifies the leader election and logs replication. In ZooKeeper-based architecture, any broker node could be designated the Kafka Controller. In Kafka Raft-based architecture, only a few nodes are set as potential controllers. Kafka controller is elected from the possible list of controllers through the Raft consensus protocol.Zookeeper Mode vs. KRaft ModeMetadata storageWhile using ZooKeeper as the quorum controller, Kafka stores information about the Kafka controller in ZooKeeper. While using the Kafka Raft protocol, such metadata is stored in an internal topic within Kafka called ‘__cluster_metadata’. This topic contains a single partition.State storageKafka Raft uses an event-sourcing-based variant of the Raft consensus protocol. Since the events related to state changes are stored in a Kafka topic, the quorum's state can be recreated at any point in time through a replay. This differs from ZooKeeper-based architecture in which state changes were isolated events with no ordering maintained within them.Setting up Kafka with RaftYou can quickly start Kafka in Raft mode using the default configuration files bundled with Kafka. Kafka requires JDK as a prerequisite. Assuming you have an instance with a JDK setup, run the steps below.Download the latest version of Kafka here and extract it. tar -xzf kafka_2.13-xxx.tgz cd kafka_2.13-xxxUse the below command to generate the cluster's unique id.KAFKA_CLUSTER_ID="$(bin/kafka-storage.sh random-uuid)"bin/kafka-storage.sh format -t $KAFKA_CLUSTER_ID -c config/kraft/server.propertiesUse the default Kafka raft property files to start the Kafka broker.bin/kafka-server-start.sh config/kraft/server.propertiesThats it! Kafka in Raft mode shouldComments
Allow the data path between the client and listener.Info about the route resource can be found here.We are going to configure one service for initial load balancing and then one service and one route per broker.ConfigurationInitial balancing Service and RouteService Name: kafka-svcRoute Name: kafka-routeBroker1# Kubernetes SettingsPod name: kafka-broker-0Service name: kafka-broker-0-svcRoute name: kafka-broker-0-route# Kafka settingslister.security.protocol.map: CLIENT:SSL, BROKER:SSL, EXTERNAL:SSLinter.broker.listener.name: BROKERlisteners: CLIENT://:9091, BROKER://:9092, EXTERNAL://:9093 advertised.listeners: CLIENT://kafka-broker-0.kafka.svc.kafka.cluster.local:9091 BROKER://kafka-broker-0:9092, EXTERNAL://kafka-broker-0.apps.ocp4.example.com:443Broker2# Kubernetes SettingsPod name: kafka-broker-1Service name: kafka-broker-1-svcRoute name: kafka-broker-1-route# Kafka settingslister.security.protocol.map: CLIENT:SSL, BROKER:SSL, EXTERNAL:SSLinter.broker.listener.name: BROKERlisteners: CLIENT://:9091, BROKER://:9092, EXTERNAL://:9093advertised.listeners: CLIENT://kafka-broker-1.kafka.svc.kafka.cluster.local:9091 BROKER://kafka-broker-1:9092, EXTERNAL://kafka-broker-1.apps.ocp4.example.com:443Broker3# Kubernetes SettingsPod name: kafka-broker-2Service name: kafka-broker-2-svcRoute name: kafka-broker-2-route# Kafka settingslister.security.protocol.map: CLIENT:SSL, BROKER:SSL, EXTERNAL:SSLinter.broker.listener.name: BROKERlisteners: CLIENT://:9091, BROKER://:9092, EXTERNAL://:9093advertised.listeners: CLIENT://kafka-broker-2.kafka.svc.kafka.cluster.local:9091 BROKER://kafka-broker-2:9092, EXTERNAL://kafka-broker-2.apps.ocp4.example.com:443Using the services FQDN ensures that pods from all namespaces can resolve the service hostname. The pod running the client receives the address kafka-broker-0.kafka.svc.kafka.cluster.local which resolves to the broker pods IP address.TopologyExternal Client ConnectionSummaryConfiguring listeners and advertised listeners can take a bit of time to get your head around, particularly the difference between the settings. Gaining an understanding of these configuration options will help simplify designing a Kafka architecture for client connectivity.Page logo image source:
2025-04-08Kafka is complex. Removing Zookeeper simplifies Kafka’s security model.[CTA_MODULE]ZooKeeper mode vs. KRaft modeKRaft is a consensus protocol that simplifies the leader election and logs replication. In ZooKeeper-based architecture, any broker node could be designated the Kafka Controller. In Kafka Raft-based architecture, only a few nodes are set as potential controllers. Kafka controller is elected from the possible list of controllers through the Raft consensus protocol.Zookeeper Mode vs. KRaft ModeMetadata storageWhile using ZooKeeper as the quorum controller, Kafka stores information about the Kafka controller in ZooKeeper. While using the Kafka Raft protocol, such metadata is stored in an internal topic within Kafka called ‘__cluster_metadata’. This topic contains a single partition.State storageKafka Raft uses an event-sourcing-based variant of the Raft consensus protocol. Since the events related to state changes are stored in a Kafka topic, the quorum's state can be recreated at any point in time through a replay. This differs from ZooKeeper-based architecture in which state changes were isolated events with no ordering maintained within them.Setting up Kafka with RaftYou can quickly start Kafka in Raft mode using the default configuration files bundled with Kafka. Kafka requires JDK as a prerequisite. Assuming you have an instance with a JDK setup, run the steps below.Download the latest version of Kafka here and extract it. tar -xzf kafka_2.13-xxx.tgz cd kafka_2.13-xxxUse the below command to generate the cluster's unique id.KAFKA_CLUSTER_ID="$(bin/kafka-storage.sh random-uuid)"bin/kafka-storage.sh format -t $KAFKA_CLUSTER_ID -c config/kraft/server.propertiesUse the default Kafka raft property files to start the Kafka broker.bin/kafka-server-start.sh config/kraft/server.propertiesThats it! Kafka in Raft mode should
2025-04-15Management, reduced waste, and improved supply chain efficiency.5. Smart Home AutomationSmart home devices like thermostats, lighting systems, and security systems generate significant data. MQTT can be used to connect these devices, while Kafka processes and analyzes the data in real time. This can enable energy savings, increased security, and a more comfortable living environment.Integrating MQTT and Apache Kafka: Getting StartedSeveral options exist for integrating MQTT and Kafka. One of the popular approaches is using Kafka Connect, which is a framework for connecting Kafka with external systems. MQTT source and sink connectors are available for Kafka Connect, allowing seamless data ingestion and transmission between the two technologies.Another option we discussed in our manufacturing example is using HiveMQ Enterprise Extension for Kafka – an MQTT-Kafka bridge that allows bi-directional data flow between the two protocols.MQTT and Kafka integration via HiveMQ ClusterThe MQTT-Kafka bridge is a translator between the two protocols, converting messages from MQTT to Kafka and vice versa. This can be useful in scenarios where data needs to be processed in real-time, such as in IoT environments.You’ll need to configure a few components to set up the MQTT-Kafka bridge. First, you’ll need an MQTT broker, the hub for all MQTT messages. You’ll also need a Kafka broker responsible for receiving and processing Kafka messages. In addition, you’ll need to install the MQTT-Kafka bridge, which can be downloaded from various sources such as GitHub.Once you have all the necessary components, you’ll need to configure the MQTT-Kafka bridge. This involves specifying the MQTT broker’s address, the Kafka broker’s address, and the topics to subscribe to and publish messages to. You’ll also need to also specify the format of the messages, which can be JSON or Avro.After configuring the bridge, you can start publishing and subscribing to messages between MQTT and Kafka. Messages published to the MQTT broker will be automatically translated to Kafka messages and sent to the Kafka broker. Similarly, messages published to the Kafka broker will be translated to MQTT messages and sent to the MQTT broker.The HiveMQ Enterprise Extension for Kafka can utilize Confluent Schema Registry for message transformation for
2025-04-20Skip to main content This browser is no longer supported. Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support. What is Azure Event Hubs for Apache Kafka? Article12/18/2024 In this article -->This article explains how you can use Azure Event Hubs to stream data from Apache Kafka applications without setting up a Kafka cluster on your own.OverviewAzure Event Hubs provides an Apache Kafka endpoint on an event hub, which enables users to connect to the event hub using the Kafka protocol. You can often use an event hub's Kafka endpoint from your applications without any code changes. You modify only the configuration, that is, update the connection string in configurations to point to the Kafka endpoint exposed by your event hub instead of pointing to a Kafka cluster. Then, you can start streaming events from your applications that use the Kafka protocol into event hubs, which are equivalent to Kafka topics.To learn more about how to migrate your Apache Kafka applications to Azure Event Hubs, see the migration guide.NoteThis feature is supported only in the **standard, premium, and dedicated tiers.Event Hubs for Apache Kafka Ecosystems support Apache Kafka version 1.0 and later.Apache Kafka and Azure Event Hubs conceptual mappingConceptually, Apache Kafka and Event Hubs are very similar. They're both partitioned logs built for streaming data, whereby the client controls which part of the retained log it wants to read. The following table maps concepts between Apache Kafka and Event Hubs.Apache Kafka ConceptEvent Hubs ConceptClusterNamespaceTopicAn event hubPartitionPartitionConsumer GroupConsumer GroupOffsetOffsetApache Kafka features supported on Azure Event HubsKafka StreamsKafka Streams is a client library for stream analytics that is part of the Apache Kafka open-source project, but is separate from the Apache Kafka event broker.NoteKafka Streams is currently in Public preview in Premium, and Dedicated tier.Azure Event Hubs supports the Kafka Streams client library, with details and concepts available here.The most common reason Azure Event Hubs customers ask for Kafka Streams support is because they're interested in Confluent's "ksqlDB" product. "ksqlDB" is a proprietary shared source project that is licensed such that no vendor "offering software-as-a-service, platform-as-a-service, infrastructure-as-a-service, or other similar online services that compete with Confluent products or services" is permitted to use or offer "ksqlDB" support. Practically, if you use ksqlDB, you must either operate Kafka yourself or you must use Confluent’s cloud offerings. The licensing terms might also affect Azure customers who offer
2025-04-02Kafka App for Sumo Logic Monitor the availability, performance and resource utilization of Kafka messaging/streaming clusters with Sumo Logic dashboards and alerts Deep visibility into the operations of your Kafka clusters " data-src=" width="64" height="64" alt="Icon monitor release candidates 2 color"> Comprehensive Kafka Node monitoring Comprehensive monitoring of Kafka broker and zookeeper nodes to get insights into requests, responses, throughput connections, sessions, partitions, controllers and resource utilization Get insight into Kafka Topics Gives you insight into the throughput and partitions of Kafka topics " data-src=" width="45" height="45" alt="App and integration 2 color"> Replication Monitoring Understand the state of replicas in your Kafka cluster Kafka Broker Monitoring Get detailed and summary views of the state of your partitions, active controllers, leaders, throughput, and network across Kafka brokers. Kafka Topic Monitoring Get detailed and summary views into throughput, partition sizes and offsets across Kafka brokers, topics and clusters. Kafka Alerts Pre-packaged Sumo Logic alerts help you monitor your Kafka cluster, are based on Sumo Logic monitors, leverage metrics and logs, and include preset thresholds for high resource utilization, disk usage, errors, failed connections, under replicated and offline partitions, unavailable replicas, consumer replica lag and other critical conditions. Related applications
2025-04-18Apache Kafka For Absolute BeginnersThis is the central repository for all the materials related to Apache Kafka For Absolute Beginners Course by Prashant Pandey. You can get the full course at Apache Kafka @ Udemy. Description I am creating Apache Kafka for absolute beginners course to help you understand the Apache Kafka Stack, the architecture of Kafka components, Kafka Client APIs (Producers and Consumers) and apply that knowledge to create Kafka programs in Java. Who should take this Course?This course is designed for software engineers, solution architects, and managers willing to implement Kafka and solve real-time stream processing problems. I am also creating this course for data architects and data engineers who are responsible for designing and building the organization’s data-centric infrastructure. Another group of people is the managers and architects who do not directly work with Kafka implementation. Still, they work with the people who implement Kafka Streams at the ground level.Kafka and source code versionThis Course is using the Apache Kafka 2.x. I have tested all the source code and examples used in this Course on Apache Kafka 2.5 open-source distribution.
2025-04-09