56 SECTIONS · 1363 TOPICS
Kafka Roadmap
Understanding Kafka Architecture
- 1. Understanding Broker Role
- Example: Broker Configuration
- 2. Understanding Topics and Partitions
- Example: Publishing to a Topic with Partitions
- Partitioning Strategy
- 3. Understanding Producers and Consumers
- Example: Producer Configuration
- Example: Consumer Configuration
- 4. Understanding Consumer Groups
- Example: Consumer Group Configuration
- Key Points About Consumer Groups
- Consumer Groups vs. Independent Consumers
- 5. Understanding Replication
- Example: Replication Configuration
- 6. Understanding Log Segments
- Example: Log Segment Configuration
- 7. Understanding Offsets
- Example: Fetching Offsets
- 8. Understanding Message Flow
- Example: Producer to Consumer Flow
- Message Flow Steps
- 9. Understanding ZooKeeper Role
- Example: ZooKeeper Ensemble Configuration
- 10. Understanding KRaft Architecture
- Example: KRaft Configuration
- KRaft vs ZooKeeper Architecture
Installing and Configuring Kafka
- 1. Downloading Kafka
- Example: Download and Extract Kafka
- 2. Setting Up Java Requirements
- Example: Verify Java Installation
- 3. Configuring Broker Properties
- Example: Setting up broker configuration
- 4. Setting Broker ID
- Example: Setting Broker ID in server.properties
- 5. Configuring Log Directories
- Example: Setting up multiple log directories
- 6. Configuring Listeners
- Example: Configuring SSL Listeners
- 7. Setting Up Cluster ID
- Example: Manually Setting Cluster ID
- 8. Starting ZooKeeper Server
- Example: Starting ZooKeeper Server
- 9. Starting Kafka Broker
- Example: Start Kafka Broker
- Startup Process Overview
- 10. Using KRaft Mode
- Example: Minimal KRaft Configuration
- 11. Verifying Installation
- Example: Check Kafka version
Managing Topics
- 1. Creating Topics
- Example: Create a topic with default configuration
- 2. Listing Topics
- 3. Describing Topics
- Example: Describe a Kafka Topic
- 4. Setting Partition Count
- Example: Creating a topic with 4 partitions
- Example: Changing partition count for an existing topic
- 5. Setting Replication Factor
- Example: Setting Replication Factor
- 6. Altering Topic Configuration
- Example: Altering topic configuration using CLI
- 7. Deleting Topics
- Example: Delete Topic via CLI
- 8. Configuring Topic Retention
- Example: Setting retention policy for a topic
- 9. Setting Cleanup Policy
- Example: Configuring Cleanup Policy for a Topic
- 10. Configuring Segment Settings
- Example: Setting Segment Size and Retention
Working with Partitions
- 1. Understanding Partition Assignment
- Example: Consumer Group with Partition Assignment
- Key Concepts
- 2. Specifying Partition Key
- Example: Setting Partition Key
- 3. Viewing Partition Distribution
- Example: Using Kafka CLI to describe partitions
- 4. Adding Partitions
- Example: Adding Partitions to a Topic
- Key Considerations When Adding Partitions
- 5. Understanding Leader Election
- Example: Configuring Unclean Leader Election
- Leader Election Process
- 6. Understanding Log Segments
- Example: Configuring Log Segment Settings
- 7. Configuring Preferred Leader Election
- Example: Setting Preferred Leader Election Policy
- 8. Configuring Min In-Sync Replicas
- Example: Setting min.insync.replicas
- 9. Setting Partition Assignment Strategy
- Example: Configuring Partition Assignment Strategy
- 10. Manual Partition Reassignment
- Example: Reassigning partitions manually
- Example: Reassignment JSON structure
- Workflow for manual partition reassignment
Producing Messages
- 1. Creating Producer Instance
- Example: Creating a Kafka Producer in Java
- 2. Setting Producer Properties
- Example: Producer Configuration
- 3. Configuring Bootstrap Servers
- Example: Producer Configuration with Bootstrap Servers
- 4. Configuring Serializers
- Example: Using JsonSerializer
- 5. Sending Messages
- Example: Sending a JSON Message
- 6. Using Synchronous Send
- Example: Synchronous Send
- 7. Using Asynchronous Send
- Example: Asynchronous Send with Callback
- Key Points
- 8. Setting Message Key
- Example: Setting Message Key
- 9. Specifying Target Partition
- Example: Using a specific partition
- 10. Adding Message Headers
- Example: Adding Headers to a Message
- 11. Configuring Acknowledgments
- Example: Setting Ack Mode in Producer Configuration
- 12. Flushing Producer Buffer
- Example: Flushing Producer Buffer
Configuring Producer Settings
- 1. Setting Batch Size
- Example: Configuring batch size
- 2. Configuring Linger Time
- Example: Setting linger.ms to 5ms
- 3. Setting Buffer Memory
- Example: Configuring Buffer Memory
- 4. Configuring Compression
- Example: Configuring GZIP Compression
- 5. Setting Max Request Size
- Example: Configuring max.request.size
- 6. Setting Request Timeout
- Example: Configuring Request Timeout
- 7. Configuring Delivery Timeout
- Example: Setting Delivery Timeout
- 8. Configuring Retries
- Example: Producer with Retry Configuration
- 9. Setting Idempotence
- Example: Idempotent Producer Configuration
- 10. Configuring Max In-Flight Requests
- Example: Setting max.in.flight.requests.per.connection
Consuming Messages
- 1. Creating Consumer Instance
- Example: Creating a Basic Consumer Instance
- 2. Setting Consumer Properties
- Example: Consumer Configuration
- 3. Configuring Bootstrap Servers
- Example: Setting Bootstrap Servers
- 4. Configuring Deserializers
- Example: Custom Deserializer Configuration
- 5. Setting Consumer Group
- Example: Consumer Group Configuration
- 6. Subscribing to Topics
- Example: Subscribing to Topics
- Example: Subscribing with Pattern
- 7. Polling Messages
- Example: Polling Messages
- 8. Processing Records
- Example: Basic Record Processing
- Example: Manual Offset Committing
- 9. Using Manual Assignment
- Example: Manual Partition Assignment
- 10. Seeking to Position
- Example: Seek to Specific Offset
- 11. Closing Consumer
- Example: Closing Consumer
Configuring Consumer Settings
- 1. Setting Fetch Size
- Example: Configuring Fetch Size
- 2. Configuring Fetch Wait Time
- Example: Setting Fetch Wait Time
- 3. Setting Max Poll Records
- Example: Configuring max.poll.records
- 4. Setting Max Partition Fetch Bytes
- Example: Configuring max.partition.fetch.bytes
- 5. Configuring Partition Assignment Strategy
- Example: Setting Partition Assignment Strategy
- Assignment Strategy Comparison
- 6. Setting Auto Offset Reset
- Example: Configuring auto.offset.reset
- 7. Configuring Isolation Level
- Example: Setting Isolation Level
- 8. Setting Session Timeout
- Example: Configuring Session Timeout
- 9. Setting Heartbeat Interval
- Example: Configuring Heartbeat Interval
- 10. Configuring Max Poll Interval
- Example: Setting max.poll.interval.ms
- 11. Configuring Check CRCs
- Example: Enabling CRC Checksum Validation
- 12. Setting Client ID
- Example: Setting Client ID
Managing Consumer Groups
- 1. Understanding Group Coordinator
- Example: Consumer Configuration with Group Coordinator
- 2. Understanding Rebalancing
- Example: Consumer Joining a Group
- Rebalancing Impact
- 3. Listing Consumer Groups
- 4. Describing Consumer Groups
- Example: Describe Consumer Group
- 5. Viewing Consumer Lag
- Example: Using Kafka Consumer Lag Metrics
- Key Metrics for Consumer Lag
- 6. Resetting Offsets
- Example: Reset Consumer Group Offsets to Beginning
- Example: Reset Offsets to Specific Datetime
- 7. Deleting Consumer Groups
- Example: Delete Consumer Group via CLI
- 8. Configuring Session Timeout
- Example: Consumer Configuration with Session Timeout
- 9. Setting Heartbeat Interval
- Example: Configuring Heartbeat Interval
- 10. Configuring Max Poll Interval
- Example: Setting max.poll.interval.ms
Managing Offsets
- 1. Understanding Offset Commits
- Example: Manual Offset Commit
- 2. Enabling Auto Commit
- Example: Configuring Auto Commit
- 3. Setting Auto Commit Interval
- Example: Configuring Auto Commit Interval
- 4. Committing Synchronously
- Example: Committing Offsets Synchronously
- 5. Committing Asynchronously
- Example: Asynchronous Commit with Callback
- 6. Committing Specific Offsets
- Example: Committing Specific Offsets
- 7. Storing Offsets Externally
- Example: Manual Offset Commit to Database
- 8. Resetting to Earliest
- Example: Resetting Consumer Group to Earliest Offset
- 9. Resetting to Latest
- Example: Resetting Offsets to Latest
- 10. Resetting to Specific Offset
- Example: Reset to Specific Offset
- Example: Reset to Earliest Offset
- 11. Resetting by Timestamp
- Example: Resetting Offsets by Timestamp
Working with Message Serialization
- 1. Understanding Serialization Concept
- Example: JSON Serialization in Kafka Producer
- 2. Using String Serializer
- Example: Producing String Messages
- 3. Using Byte Array Serializer
- Example: Publishing Byte Array Messages
- 4. Using Integer Serializer
- Example: Publishing Integer Messages
- Example: Consuming Integer Messages
- 5. Using Long Serializer
- Example: Serializing Long Values
- 6. Using JSON Serialization
- Example: Publishing JSON Messages
- Example: Consuming JSON Messages
- 7. Using Avro Serialization
- Example: Producer using Avro Serialization
- Example: Consumer using Avro Deserialization
- 8. Using Protobuf Serialization
- Example: Producer Configuration with Protobuf
- Example: Consumer Configuration with Protobuf
- 9. Creating Custom Serializers
- Example: Custom Serializer Implementation
- Example: Custom Deserializer Implementation
- 10. Handling Serialization Errors
- Example: Handling Serialization Errors in Producer
- 11. Configuring Schema Registry
- Example: Schema Registry Configuration in Producer
Understanding Message Compression
- 1. Understanding Compression Benefits
- Example: Compression Ratio Comparison
- 2. Using GZIP Compression
- Example: Configuring GZIP Compression
- 3. Using Snappy Compression
- Example: Configuring Snappy Compression
- 4. Using LZ4 Compression
- Example: Configuring LZ4 Compression in Kafka Producer
- 5. Using ZSTD Compression
- Example: Producer Configuration with ZSTD
- 6. Configuring Compression Level
- Example: Configuring Compression Level in Producer
- Example: Configuring Compression Level in Consumer
- 7. Understanding Compression Ratio
- Example: Compression Ratio Calculation
- 8. Comparing Compression Performance
- Performance Trade-offs
- 9. Setting Producer Compression
- Example: Producer Configuration with Compression
- 10. Broker Compression Handling
- Example: Configuring Broker Compression
- 11. Monitoring Compression Metrics
- Example: Monitoring Compression Metrics with JMX
Working with Message Headers
- 1. Understanding Headers Concept
- Example: Setting and Retrieving Headers
- 2. Adding Headers to Producer
- Example: Adding Headers to Producer Record
- 3. Reading Headers in Consumer
- Example: Reading Headers in a Kafka Consumer
- 4. Setting Custom Headers
- Example: Setting Custom Headers in Producer Record
- 5. Using Headers for Routing
- Example: Setting Routing Headers in Producer
- Example: Consuming with Header-Based Routing
- 6. Storing Metadata in Headers
- Example: Setting Headers in Producer
- Example: Reading Headers in Consumer
- 7. Filtering by Headers
- Example: Filtering Messages by Header
- Header Filtering Best Practices
- 8. Understanding Header Serialization
- Example: Setting and Reading Headers in Java
- 9. Propagating Headers in Streams
- Example: Setting Headers in a Stream Processor
- Key Points
- 10. Adding Trace IDs
- Example: Adding Trace ID to Kafka Message
Understanding Message Timestamps
- 1. Understanding Timestamp Types
- Example: Setting Custom Timestamp in Producer
- 2. Using Create Time
- Example: Setting Create Time in Producer
- 3. Using Log Append Time
- Example: Configuring Log Append Time
- 4. Configuring Timestamp Type
- Example: Setting Timestamp Type in Producer Configuration
- 5. Setting Producer Timestamp
- Example: Setting Producer Timestamp
- 6. Understanding Timestamp Ordering
- Example: Setting Timestamp Type in Producer Configuration
- 7. Using Timestamps for Retention
- Example: Configuring Log Retention
- 8. Filtering by Timestamp
- Example: Filtering by Timestamp Range
- 9. Configuring Timestamp Difference
- Example: Setting Timestamp Difference Limit
- 10. Resetting Offsets by Timestamp
- Example: Resetting Offsets Using AdminClient
Understanding Message Ordering
- 1. Understanding Ordering Guarantees
- Example: Producer Ordering in a Partition
- 2. Preserving Order with Single Partition
- Example: Producing messages to a single partition
- 3. Using Message Keys for Ordering
- Example: Producing Messages with Keys
- Example: Consuming Messages with Keys
- 4. Configuring Max In-Flight Requests
- Example: Setting max.in.flight.requests.per.connection
- 5. Enabling Idempotent Producer
- Example: Configuring Idempotent Producer
- 6. Understanding Ordering Across Partitions
- Example: Producer with Key-Based Partitioning
- 7. Implementing Total Ordering
- Example: Using Kafka's Total Ordering with Partitioning
- 8. Handling Out-of-Order Messages
- Example: Reordering Messages in a Consumer
- 9. Using Timestamps for Ordering
- Example: Setting Message Timestamps
- 10. Configuring Retries for Ordering
- Example: Configuring Retry Settings for Ordering
Understanding Replication
- 1. Understanding Replication Concept
- Example: Configuring Replication Factor
- 2. Understanding Leader and Followers
- Example: Partition Leadership Change
- 3. Configuring Replication Factor
- Example: Setting Replication Factor at Topic Level
- Example: Configuring min.insync.replicas
- 4. Understanding In-Sync Replicas
- Example: Configuring In-Sync Replica Settings
- 5. Configuring Replica Lag
- Example: Configuring Replica Lag in server.properties
- 6. Understanding Leader Election
- Example: Configuring Unclean Leader Election
- Leader Election Process
- 7. Understanding Replica High Watermark
- Example: Replica High Watermark in Practice
- 8. Understanding Log End Offset
- Example: Fetching Log End Offset
- 9. Configuring Preferred Leader
- Example: Preferred Leader Configuration
- 10. Understanding Replica Fetcher
- Example: Configuring Replica Fetcher Settings
- 11. Manual Replica Reassignment
- Example: Reassigning Partitions
- Example: JSON file for topics to move
- Example: JSON file for reassignment
Implementing Log Compaction
- 1. Understanding Compaction Concept
- Example: Compaction in Action
- 2. Enabling Log Compaction
- Example: Enabling Log Compaction on a Topic
- 3. Understanding Compaction Process
- Example: Compaction Configuration
- Compaction Process Overview
- 4. Understanding Tombstone Messages
- Example: Producing a Tombstone Message
- 5. Configuring Compaction Lag
- Example: Setting Compaction Lag in Kafka Configuration
- 6. Setting Delete Retention
- Example: Configuring Log Retention
- 7. Configuring Segment Size
- Example: Setting Segment Size
- 8. Setting Min Cleanable Ratio
- Example: Configuring min.cleanable.ratio
- 9. Configuring Compaction Thread
- Example: Configuring Compaction Thread Count
- 10. Setting Compaction Buffer
- Example: Configuring Compaction Buffer
- 11. Monitoring Compaction Progress
- Example: Check compaction status via Kafka Tool
- Compaction Monitoring Metrics
Understanding Message Delivery Semantics
- 1. Understanding Delivery Guarantees
- Example: Producer Configuration for At-Least-Once Delivery
- Example: Producer Configuration for Exactly-Once Delivery
- 2. Understanding At-Most-Once Delivery
- Example: Producer Configuration for At-Most-Once
- 3. Understanding At-Least-Once Delivery
- Example: Producer Configuration for At-Least-Once
- 4. Implementing Exactly-Once Semantics
- Example: Idempotent Producer Configuration
- Example: Transactional Producer Usage
- 5. Configuring Producer Idempotence
- Example: Idempotent Producer Configuration
- 6. Using Transactional Producer
- Example: Initializing a Transactional Producer
- Example: Sending Messages in a Transaction
- 7. Setting Consumer Isolation Level
- Example: Configuring Isolation Level
- 8. Understanding Duplicate Messages
- Example: Idempotent Producer Configuration
- 9. Handling Message Ordering
- Example: Producer Ordering in a Partition
- 10. Implementing Idempotent Consumer
- Example: Idempotent Producer Configuration
- 11. Understanding Message Loss Scenarios
- Example: Producer with Idempotent Writes
Implementing Transactions
- 1. Understanding Transactional Concept
- Example: Transactional Producer Setup
- 2. Enabling Transactional Producer
- Example: Configuring Transactional Producer
- 3. Initializing Transactions
- Example: Initializing Transactional Producer
- 4. Beginning Transaction
- Example: Beginning a Transaction
- 5. Sending Transactional Messages
- Example: Sending Transactional Messages
- 6. Sending Offsets in Transaction
- Example: Sending Offsets in Transaction
- 7. Committing Transaction
- Example: Committing a Transaction
- 8. Aborting Transaction
- Example: Aborting a Transaction
- 9. Configuring Transaction Timeout
- Example: Setting Transaction Timeout
- 10. Setting Read Committed
- Example: Configuring Read Committed in Producer
- Example: Configuring Read Committed in Consumer
- 11. Understanding Exactly-Once Semantics
- Example: Producer with Idempotent and Transactional Features
- Key Benefits of Exactly-Once Semantics
Implementing Retry Mechanisms
- 1. Understanding Retry Behavior
- Example: Configuring Retry Behavior
- 2. Configuring Retry Count
- Example: Producer Retry Configuration
- 3. Setting Retry Backoff
- Example: Configuring Retry Backoff
- 4. Configuring Delivery Timeout
- Example: Setting Delivery Timeout
- 5. Understanding Retriable Exceptions
- 6. Handling Non-Retriable Errors
- Example: Handling Serialization Errors
- 7. Implementing Exponential Backoff
- Example: Retry Configuration with Exponential Backoff
- 8. Using Circuit Breaker Pattern
- Example: Circuit Breaker in Kafka Producer
- Summary of Circuit Breaker States
- 9. Configuring Request Timeout
- Example: Setting Request Timeout
- 10. Implementing Consumer Retry Logic
- Example: Consumer Retry Configuration
- Example: Handling Retry Logic in Consumer
Configuring Broker Settings
- 1. Setting Broker ID
- Example: Setting Broker ID in server.properties
- 2. Configuring Listeners
- Example: Configuring Multiple Listeners
- Example: Using SASL Authentication
- 3. Setting Log Directories
- Example: Configuring Log Directories
- 4. Configuring Number of Threads
- Example: Setting I/O Threads
- 5. Setting Socket Buffer Sizes
- Example: Configuring Socket Buffer Sizes
- 6. Configuring Max Message Size
- Example: Setting max message size in server.properties
- 7. Setting Default Replication Factor
- Example: Setting Default Replication Factor
- 8. Configuring Min ISR
- Example: Setting min.insync.replicas
- 9. Setting Unclean Leader Election
- Example: Enabling Unclean Leader Election
- 10. Configuring Log Retention
- Example: Setting Log Retention
- 11. Setting Log Segment Size
- Example: Configuring Log Segment Size
- 12. Configuring Log Cleanup
- Example: Enabling Log Cleaning
Using KRaft Consensus Protocol
- 1. Understanding KRaft Architecture
- Example: KRaft Controller Configuration
- KRaft Architecture Overview
- 2. Understanding Metadata Replication
- Example: Configuring Metadata Replication
- 3. Configuring Metadata Log
- Example: Configuring Metadata Log
- 4. Setting Controller Quorum Voters
- Example: Configuring Controller Quorum Voters
- 5. Formatting Storage
- Example: Formatting Kafka Storage Directories
- 6. Starting KRaft Controller
- Example: Starting KRaft Controller
- 7. Starting KRaft Broker
- Example: Starting KRaft Broker
- 8. Using Combined Mode
- Example: Combined Mode Configuration
- 9. Configuring Controller Listener
- Example: Controller Listener Configuration
- 10. Migrating from ZooKeeper
- Example: Enabling KRaft in server.properties
- Migration Steps Summary
Managing Cluster Metadata
- 1. Understanding Metadata Topics
- Example: Consumer Group Offset Commit
- 2. Viewing Cluster Metadata
- Example: Describe a specific topic
- 3. Describing Cluster Configuration
- Example: Configuring Broker ID and Listeners
- 4. Managing Broker Configuration
- Example: Setting Broker Configuration
- 5. Understanding Controller Role
- Example: Controller Election Process
- 6. Monitoring Controller Metrics
- Example: Collecting Controller Metrics with JMX
- 7. Handling Metadata Updates
- Example: Configuring Metadata Refresh
- 8. Configuring Metadata Max Age
- Example: Setting metadata.max.age.ms
- 9. Understanding Partition Metadata
- Example: Partition Metadata in Topic Description
- 10. Debugging Metadata Issues
- Example: Checking Broker Metadata
- Workflow: Troubleshooting Metadata Sync
Using Kafka Streams
- 1. Understanding Streams Concept
- Example: Basic Stream Processing
- 2. Creating Streams Application
- Example: Basic Kafka Streams Application Setup
- 3. Building Stream Topology
- Example: Basic Kafka Streams Topology
- Building a Stream Topology
- Key Concepts in Kafka Streams Topology
- 4. Transforming Streams
- Example: Basic Transformation with Map
- Example: Filtering Records
- Example: Using FlatMap
- Transformation Operations Summary
- 5. Aggregating Streams
- 6. Joining Streams
- Example: Inner Join
- Example: Left Join
- 7. Windowing Operations
- Example: Counting Events in a Tumbling Window
- 8. Using State Stores
- Example: Using a Persistent State Store
- Example: Using an In-Memory State Store
- 9. Processing Records
- Example: Processing Records with Kafka Streams
- Processing Records Summary
- 10. Using Processors API
- Example: Custom Processor Implementation
- Example: Registering Custom Processor
- Key Concepts
- 11. Starting Streams Application
- Example: Basic Kafka Streams Application
- 12. Handling Streams Exceptions
- Example: Custom Exception Handler
- Key Points
Configuring Kafka Streams
- 1. Setting Application ID
- Example: Configuring Application ID
- 2. Configuring Bootstrap Servers
- Example: Setting Bootstrap Servers in Kafka Streams Configuration
- 3. Setting Default Serdes
- Example: Configuring Default Serdes
- 4. Configuring Commit Interval
- Example: Setting Commit Interval
- 5. Setting Cache Size
- Example: Configuring Cache Size
- 6. Configuring State Directory
- Example: Setting State Directory
- 7. Setting Processing Guarantee
- Example: Configuring Processing Guarantee
- 8. Configuring Replication Factor
- Example: Setting Replication Factor in Topic Creation
- 9. Setting Number of Threads
- Example: Configuring Number of Threads
- 10. Configuring Window Store Retention
- Example: Setting Window Store Retention
Working with Time-Based Processing
- 1. Understanding Time Semantics
- Example: Using Event Time in Kafka Streams
- 2. Understanding Event Time
- Example: Setting Event Time in a Kafka Stream
- 3. Understanding Processing Time
- Example: Processing Time Usage
- 4. Understanding Ingestion Time
- Example: Ingestion Time in Producer Record
- 5. Configuring Timestamp Extractors
- Example: Using Custom Timestamp Extractor
- 6. Implementing Custom Timestampers
- Example: Custom Timestamp Extractor Implementation
- 7. Using Tumbling Windows
- Example: Tumbling Window for Counting Events
- 8. Using Hopping Windows
- Example: Hopping Window Configuration
- 9. Using Sliding Windows
- Example: Sliding Window Configuration in Kafka Streams
- 10. Using Session Windows
- Example: Session Windows in Kafka Streams
- 11. Configuring Grace Period
- Example: Consumer Graceful Shutdown Configuration
- Example: Producer Graceful Shutdown Configuration
- 12. Handling Out-of-Order Events
- Example: Using Watermarks in Kafka Streams
Implementing Stream Joins
- 1. Understanding Join Types
- 2. Using Stream-Stream Join
- Example: Stream-Stream Join Configuration
- 3. Using Stream-Table Join
- Example: Stream-Table Join in Kafka Streams
- 4. Using Table-Table Join
- Example: Table-Table Join
- Key Considerations
- 5. Implementing Inner Join
- Example: Inner Join Implementation
- 6. Implementing Left Join
- Example: Left Join Configuration
- 7. Implementing Outer Join
- Example: Performing an Outer Join
- 8. Configuring Join Windows
- Example: Setting Join Window Duration
- 9. Setting Join Retention
- Example: Configuring Join Retention
- 10. Understanding Join Semantics
- Example: Stream-Stream Join
- 11. Optimizing Join Performance
- Example: Configuring Join Window Size
- Performance Tips
Using Kafka Connect
- 1. Understanding Connect Framework
- Example: Source Connector Configuration
- Example: Sink Connector Configuration
- Key Features of Kafka Connect
- 2. Running Standalone Mode
- Example: Standalone Configuration File
- 3. Running Distributed Mode
- Example: Distributed Mode Configuration
- Steps to Start Distributed Mode
- Key Features of Distributed Mode
- 4. Creating Source Connectors
- Example: Creating a Source Connector
- 5. Creating Sink Connectors
- Example: Creating a Sink Connector
- 6. Configuring Connector Properties
- Example: Basic Connector Configuration
- Example: Connector with Transformations
- 7. Managing Connectors via REST API
- Example: List all connectors
- Example: Create a new connector
- Example: Update connector config
- 8. Listing Connectors
- Example: Listing Connectors via REST API
- 9. Checking Connector Status
- Example: Retrieve connector status via REST API
- Example: Sample response from connector status endpoint
- 10. Pausing and Resuming Connectors
- Example: Pausing a Connector
- Example: Resuming a Connector
- 11. Deleting Connectors
- Example: Delete a Connector
Configuring Kafka Connect
- 1. Setting Bootstrap Servers
- Example: Configuring Bootstrap Servers
- 2. Configuring Key and Value Converters
- Example: Configuring JSON Converters
- Example: Configuring Avro Converters
- Key vs Value Converter Differences
- 3. Setting Offset Storage
- Example: Configure Offset Storage
- 4. Configuring Config Storage
- Example: Configuring Kafka-based Storage
- 5. Setting Status Storage
- Example: Configure Status Storage Topic
- 6. Configuring Replication Factor
- Example: Setting Replication Factor for a Topic
- 7. Setting Group ID
- Example: Configuring Group ID in Connect Worker Properties
- 8. Configuring Plugin Path
- Example: Setting Plugin Path
- 9. Setting REST Port
- Example: Configure REST Port
- 10. Configuring Internal Topics
- Example: Internal Topic Configuration
Using Schema Registry
- 1. Understanding Schema Registry Role
- Example: Schema Registration
- 2. Installing Schema Registry
- Example: Installing Schema Registry on Ubuntu
- Installation Steps
- 3. Configuring Schema Registry URL
- Example: Producer Configuration
- Example: Consumer Configuration
- 4. Registering Schemas
- Example: Registering a new schema
- 5. Retrieving Schemas
- Example: Retrieve Schema by ID
- Example: Retrieve Schema Version
- Example: List All Subjects
- 6. Listing Subjects
- Example: List all subjects
- Example: List all versions of a subject
- Example: Get schema by ID
- 7. Deleting Schema Versions
- Example: Delete Schema Version
- 8. Setting Compatibility Mode
- Example: Configuring Compatibility Mode via REST API
- 9. Checking Compatibility
- Example: Checking Schema Compatibility
- 10. Exporting Schemas
- Example: Export Schema to File
Managing Schema Evolution
- 1. Understanding Schema Compatibility
- Example: Schema Registry Configuration
- Schema Compatibility Rules
- 2. Implementing Backward Compatibility
- Example: Adding Fields to Schema
- 3. Implementing Forward Compatibility
- Example: Schema Registry Configuration
- 4. Using Full Compatibility
- Example: Schema Evolution with FULL Compatibility
- 5. Using Transitive Compatibility
- Example: Registering a Schema with Transitive Compatibility
- 6. Configuring Compatibility Level
- Example: Setting Compatibility Level in Schema Registry
- 7. Handling Schema Evolution Errors
- Example: Schema Registry Error Handling
- Common Schema Evolution Error Scenarios
- 8. Versioning Schemas
- Example: Schema Versioning in Avro
- Example: Adding a New Field to Schema
- 9. Using Schema References
- Example: Defining a Schema with References
- 10. Migrating Schema Formats
- Example: Converting Avro to JSON Schema
Implementing Custom Partitioners
- 1. Understanding Partitioner Concept
- Example: Default Partitioner Behavior
- Key Points
- 2. Creating Custom Partitioner
- Example: Custom Partitioner Implementation
- 3. Implementing partition() Method
- Example: Custom Partitioner Implementation
- 4. Configuring Partitioner Class
- Example: Custom Partitioner Configuration
- 5. Using Hash-Based Partitioning
- Example: Hash-Based Partitioning Configuration
- Example: Producer with Key for Hash Partitioning
- 6. Implementing Round-Robin Partitioning
- Example: Producer Configuration with Round-Robin Partitioner
- 7. Creating Sticky Partitioner
- Example: Using Sticky Partitioner in Producer Configuration
- Key Features of Sticky Partitioner
- 8. Implementing Range Partitioner
- Example: Range Partitioner Implementation
- Key Features of Range Partitioner
- 9. Using Composite Key Partitioning
- Example: Custom Partitioner Implementation
- 10. Handling Null Keys
- Example: Custom Partitioner with Null Key Handling
Implementing Custom Interceptors
- 1. Understanding Interceptor Concept
- Example: Basic Producer Interceptor
- Example: Basic Consumer Interceptor
- 2. Creating Producer Interceptor
- Example: Implementing a Kafka Producer Interceptor
- 3. Creating Consumer Interceptor
- Example: Basic Consumer Interceptor Implementation
- 4. Implementing onSend() Method
- Example: Modifying Record Before Sending
- 5. Implementing onConsume() Method
- Example: Implementing onConsume()
- 6. Configuring Interceptor Chain
- Example: Producer Interceptor Configuration
- Example: Consumer Interceptor Configuration
- 7. Adding Monitoring Metrics
- Example: Custom Interceptor with Metrics
- 8. Implementing Tracing
- Example: Basic Tracing Interceptor
- Tracing Interceptor Configuration
- 9. Adding Security Checks
- Example: Authentication Check
- Example: Authorization Check
- 10. Transforming Messages
- Example: Modifying Message Value
- Example: Adding Headers to Messages
Using Admin API
- 1. Creating Admin Client
- Example: Creating Admin Client
- 2. Creating Topics
- Example: Create a topic with default configuration
- 3. Listing Topics
- Example: List all topics
- 4. Describing Topics
- Example: Describe a Topic
- Example: Describe Topics with Detailed Information
- 5. Deleting Topics
- Example: Delete a Kafka Topic
- 6. Creating Partitions
- Example: Creating Partitions via Admin Client
- 7. Altering Configs
- Example: Altering Topic Configs
- 8. Describing Configs
- Example: Describe Broker Configs
- Example: Describe Topic Configs
- 9. Describing Consumer Groups
- Example: Describe Consumer Group
- 10. Listing Consumer Groups
- Example: Listing Consumer Groups via Admin Client
- 11. Deleting Consumer Groups
- Example: Delete Consumer Group
- 12. Deleting Records
- Example: Deleting Records from a Topic
Using Console Tools
- 1. Producing Messages
- Example: Produce a message to a Kafka topic
- 2. Consuming Messages
- Example: Consuming messages from a topic
- Example: Consuming messages with custom deserializer
- 3. Reading from Beginning
- Example: Read from Beginning
- 4. Specifying Consumer Group
- Example: Consumer Group Configuration
- 5. Setting Message Format
- Example: Setting JSON format for message consumption
- Example: Setting Avro format for message production
- 6. Using Key Deserializer
- Example: Configuring Key Deserializer
- 7. Setting Partition
- Example: Create topic with 3 partitions
- 8. Reading Specific Offset
- Example: Reading from a specific offset
- 9. Displaying Message Timestamp
- Example: Displaying Message Timestamps in Console Consumer
- 10. Using Timeout
- Example: Setting Timeout for Console Consumer
Using Kafka CLI Tools
- 1. Managing Topics
- Example: Creating a Topic with Custom Configuration
- 2. Working with Consumer Groups
- Example: List consumer groups
- Example: Describe consumer group
- Example: Reset consumer group offsets to earliest
- 3. Managing ACLs
- Example: Create ACL for a user to read a topic
- Example: List all ACLs
- Example: Delete an ACL
- 4. Managing Configs
- Example: View Topic Configs
- Example: Executing a reassignment plan
- Example: Verifying a reassignment plan
- 6. Preferred Leader Election
- Example: Enable Preferred Replica Election
- 7. Verifying Consumer Group
- Example: Describe consumer groups
- 8. Verifying Producer
- Example: Send a message using the console producer
- 9. Dumping Log Segments
- Example: Dump log segments for a topic
- 10. Mirroring Data
- Example: Mirroring Topics
- 11. Running Performance Tests
- Example: Kafka Test Tools Configuration
- Performance Test Summary
Implementing Security
- 1. Understanding Kafka Security Model
- Example: Enabling SSL/TLS Authentication
- Kafka Security Layers
- 2. Enabling SSL Encryption
- Example: Broker SSL Configuration
- 3. Configuring SSL Certificates
- Example: Basic SSL Configuration
- Example: Generating a Self-Signed Certificate
- Example: Creating a Truststore
- 4. Setting Keystore Password
- Example: Configuring Keystore Password
- 5. Configuring SSL Endpoint Identification
- Example: Kafka SSL Configuration
- 6. Enabling SASL Authentication
- Example: SASL Configuration in server.properties
- 7. Configuring SASL/PLAIN
- Example: Kafka Server Configuration
- Example: Client Configuration
- 8. Using SASL/SCRAM
- Example: Configuring SASL/SCRAM for Kafka Broker
- Example: Configuring SASL/SCRAM for Kafka Client
- 9. Configuring SASL/GSSAPI
- Example: Kafka Server Configuration for GSSAPI
- 10. Setting Up SASL/OAUTHBEARER
- Example: Producer Configuration
- Example: Consumer Configuration
- 11. Enabling Inter-Broker Security
- Example: Enabling SSL for Inter-Broker Communication
Managing Access Control
- 1. Understanding ACL Model
- Example: ACL Configuration
- Key ACL Concepts
- 2. Enabling Authorization
- Example: Enable ACL authorization in Kafka
- 3. Creating ACLs
- Example: Create ACL for Topic Read Access
- Example: Create ACL for Consumer Group Access
- 4. Listing ACLs
- Example: Listing ACLs for a Specific Topic
- Example: Listing ACLs for a Specific User
- 5. Removing ACLs
- Example: Remove ACL for a Topic
- 6. Setting Principal Format
- Example: Configuring Principal Format
- 7. Configuring Super Users
- Example: Define super users in Kafka
- 8. Understanding ACL Operations
- Example: Creating an ACL to allow reading from a topic
- 9. Setting Resource Patterns
- Example: Configure Resource Pattern for Topics
- Example: Configure Resource Pattern for Consumer Groups
- 10. Using Wildcard ACLs
- Example: Define ACLs with Wildcards
- 11. Configuring ACL Binding
- Example: Configuring ACL Binding for a Topic
- Example: Configuring ACL Binding for a Consumer Group
Configuring Quotas
- 1. Understanding Quotas Concept
- 2. Setting Producer Quotas
- Example: Configuring Producer Quotas in server.properties
- 3. Configuring Consumer Quotas
- Example: Consumer Quota Configuration
- 4. Setting Request Quotas
- Example: Configuring Request Quotas in server.properties
- 5. Configuring Client-Level Quotas
- Example: Configuring Client-Level Quotas in server.properties
- Example: Configuring User-Level Consumer Byte Rate
- 7. Using Default Quotas
- Example: Default Quota Configuration
- 8. Configuring Quota Window
- Example: Setting Quota Window Configuration
- 9. Monitoring Quota Violations
- Example: Configuring quota monitoring in Kafka
- Example: Using JConsole to monitor quota violations
- Quota Monitoring Best Practices
- 10. Dynamic Quota Configuration
- Example: Configure Producer Byte Rate
- Example: Configure Consumer Byte Rate
Implementing Dead Letter Queues
- 1. Understanding DLQ Pattern
- Example: DLQ Configuration in Kafka
- Key Benefits of DLQ Pattern
- 2. Creating DLQ Topic
- Example: Create DLQ Topic
- 3. Routing Failed Messages
- Example: Configuring Dead Letter Topic
- Example: Consumer Configuration for DLQ
- 4. Configuring DLQ in Streams
- Example: Basic DLQ Configuration
- Key Points
- 5. Using DLQ in Connect
- Example: Configuring DLQ in a Kafka Connect Connector
- DLQ Configuration Summary
- 6. Adding Error Metadata
- Example: Adding Error Metadata to a Dead Letter Message
- 7. Monitoring DLQ
- Example: Monitoring DLQ with Prometheus and Grafana
- Example: Grafana Dashboard Setup
- 8. Reprocessing DLQ Messages
- Example: Reprocessing DLQ Messages
- 9. Setting DLQ Retention
- Example: Configuring DLQ Retention
- 10. Implementing Circuit Breaker
- Example: Basic Circuit Breaker Pattern with Kafka
- Key Concepts
Handling Errors and Exceptions
- 1. Understanding Producer Exceptions
- Example: Handling SerializationException
- 2. Handling Timeout Exceptions
- Example: Configuring Timeout Settings
- 3. Dealing with Serialization Errors
- Example: Handling Serialization Errors in Producer
- Best Practices for Serialization Error Handling
- 4. Handling Authorization Failures
- Example: Configuring ACL-based Authorization
- Common Authorization Failure Scenarios
- Authorization vs Authentication
- 5. Managing Retriable Exceptions
- Example: Retry Logic with Exponential Backoff
- Best Practices for Retriable Exceptions
- 6. Handling Non-Retriable Errors
- Example: Handling Serialization Errors
- 7. Understanding Consumer Exceptions
- Example: Handling RetriableConsumerException
- 8. Handling Offset Out of Range
- Example: Configuring Offset Reset Behavior
- 9. Dealing with Rebalance Exceptions
- Example: Handling Rebalance Exceptions in Consumer
- 10. Configuring Error Handlers
- Example: Dead Letter Queue Configuration
- Example: Retryable Error Handler Setup
Optimizing Producer Performance
- 1. Tuning Batch Size
- Example: Configuring Batch Size
- 2. Configuring Linger Time
- Example: Setting linger.ms to 5ms
- 3. Optimizing Compression
- Example: Producer Configuration with Compression
- 4. Setting Buffer Memory
- Example: Configuring Buffer Memory
- 5. Configuring Max In-Flight Requests
- Example: Setting max.in.flight.requests.per.connection
- 6. Using Idempotent Producer
- Example: Idempotent Producer Configuration
- 7. Optimizing Serialization
- Example: Using Avro with Kafka Producer
- 8. Tuning Request Timeout
- Example: Setting Request Timeout
- 9. Configuring Retries
- Example: Producer Configuration with Retry Settings
- 10. Monitoring Producer Metrics
- Example: Producer Metrics Configuration
Optimizing Consumer Performance
- 1. Tuning Fetch Size
- Example: Configuring Fetch Size
- 2. Configuring Fetch Wait Time
- Example: Configuring fetch.wait.max.ms
- 3. Setting Max Poll Records
- Example: Configuring max.poll.records
- 4. Optimizing Partition Assignment
- Example: Configuring Partition Assignment Strategy
- 5. Using Parallel Processing
- Example: Consumer Group with Multiple Threads
- Best Practices for Parallel Processing
- 6. Configuring Prefetching
- Example: Configuring Prefetching Parameters
- 7. Optimizing Deserialization
- Example: Custom Deserializer
- 8. Tuning Commit Frequency
- Example: Configuring Auto Commit Interval
- 9. Using Asynchronous Commits
- Example: Asynchronous Commit Usage
- 10. Monitoring Consumer Metrics
- Example: Consumer Metrics Configuration
Optimizing Broker Performance
- 1. Tuning Number of Partitions
- Example: Setting Partition Count for a Topic
- Best Practices for Partition Tuning
- 2. Optimizing Replica Fetcher Threads
- Example: Configuring Replica Fetcher Threads
- 3. Configuring Network Threads
- Example: Adjusting Network Thread Configuration
- 4. Tuning I/O Threads
- Example: Configuring I/O Threads
- 5. Optimizing Log Segment Size
- Example: Configuring Log Segment Size
- 6. Configuring Zero-Copy Transfer
- Example: Enabling Zero-Copy Transfer
- 7. Tuning Flush Settings
- Example: Configuring Flush Settings
- 8. Optimizing Page Cache
- Example: Configuring Log Flush Settings
- 9. Setting Socket Buffer Sizes
- Example: Configuring Socket Buffer Sizes
- 10. Monitoring Broker Metrics
- Example: Monitoring Kafka Broker Metrics with JMX
Optimizing Consumer Rebalancing
- 1. Understanding Rebalance Protocol
- Example: Consumer Group Joining
- Rebalance Phases
- 2. Configuring Session Timeout
- Example: Consumer Configuration
- 3. Setting Heartbeat Interval
- Example: Configuring Heartbeat Interval
- 4. Configuring Max Poll Interval
- Example: Setting max.poll.interval.ms
- 5. Using Cooperative Rebalancing
- Example: Enabling Cooperative Rebalancing
- Benefits of Cooperative Rebalancing
- Cooperative vs. Classic Rebalancing
- 6. Implementing Static Membership
- Example: Configuring Static Membership
- 7. Minimizing Rebalance Overhead
- Example: Consumer Configuration
- 8. Using Incremental Rebalancing
- Example: Configuring Incremental Rebalancing
- 9. Handling Rebalance Listeners
- Example: Implementing Rebalance Listeners
- 10. Monitoring Rebalance Latency
- Example: Configuring Rebalance Monitoring
- Key Metrics to Monitor
Monitoring Broker Metrics
- 1. Understanding JMX Metrics
- Example: Fetching JMX Metrics via JConsole
- 2. Monitoring Bytes In/Out Rate
- Example: Kafka Broker Metrics Configuration
- 3. Tracking Message Rate
- Example: Monitoring Message Rate via JMX
- 4. Monitoring Request Metrics
- Example: Configuring Request Metrics in Kafka
- 5. Checking Under-Replicated Partitions
- Example: Using Kafka Consumer Groups to Identify Under-Replicated Partitions
- 6. Monitoring ISR Shrink/Expand
- Example: ISR Shrink Alert Configuration
- 7. Tracking Leader Election Rate
- Example: Configuring Kafka to expose leader election rate
- 8. Monitoring Log Flush Latency
- Example: Configuring Log Flush Interval
- 9. Checking Network Processor Idle
- Example: Monitoring Idle Percent
- 10. Monitoring Request Queue Size
- Example: Monitoring Request Queue Size via JMX
Monitoring Producer Metrics
- 1. Tracking Record Send Rate
- Example: Monitoring send rate with JMX
- 2. Monitoring Batch Size
- Example: Configuring Batch Size
- 3. Checking Compression Ratio
- Example: Configuring Compression
- 4. Monitoring Record Queue Time
- Example: Configuring Producer Metrics
- 5. Tracking Request Latency
- Example: Monitoring Request Latency with JMX
- 6. Monitoring Buffer Available Bytes
- Example: Configuring Buffer Size
- 7. Checking Waiting Threads
- Example: Monitoring Waiting Threads
- 8. Tracking Record Error Rate
- Example: Error Rate Monitoring
- 9. Monitoring Record Retry Rate
- Example: Configuring Retry Rate
- 10. Checking Metadata Age
- Example: Configuring Metadata Age
Monitoring Consumer Metrics
- 1. Tracking Fetch Rate
- Example: Fetch Rate Monitoring
- 2. Monitoring Records Consumed
- Example: Consuming Records with Metrics
- 3. Checking Consumer Lag
- Example: Consumer Lag Monitoring with Kafka Consumer Groups
- 4. Monitoring Fetch Latency
- Example: Fetch Latency Configuration
- 5. Tracking Commit Rate
- Example: Commit Rate Monitoring
- 6. Monitoring Join Rate
- Example: Consumer Group Join Rate Monitoring
- 7. Checking Sync Rate
- Example: Monitoring Sync Rate
- 8. Tracking Heartbeat Response Time
- Example: Configuring Heartbeat Response Time Monitoring
- 9. Monitoring Last Poll Time
- Example: Consumer Configuration
- 10. Checking Assigned Partitions
- Example: Consumer Group Assigned Partitions
Managing Cluster Operations
- 1. Adding Brokers to Cluster
- Example: Adding a New Broker Configuration
- Workflow: Adding a Broker to an Existing Cluster
- 2. Removing Brokers from Cluster
- Example: Decommissioning a Broker
- 3. Expanding Cluster
- Example: Adding a New Broker to Kafka Cluster
- Steps to Expand Kafka Cluster
- 4. Balancing Partition Load
- Example: Configuring Partition Assignment Strategy
- Example: Setting Replication Factor
- Partition Load Balancing Best Practices
- 5. Rolling Restart
- Example: Rolling Restart Script
- Steps to Perform a Rolling Restart
- Best Practices for Rolling Restart
- 6. Upgrading Kafka Version
- Example: Rolling Upgrade Process
- Upgrade Workflow
- Upgrade Considerations
- 7. Migrating to KRaft Mode
- Example: KRaft Controller Configuration
- Example: ZooKeeper Mode Configuration (Legacy)
- Migration Steps Overview
- 8. Handling Broker Failures
- Example: Monitoring Broker Health
- Recovery Steps Summary
- Broker Failure vs. Partition Reassignment
- 9. Managing Disk Space
- Example: Configuring Log Retention
- Example: Setting Up Disk Space Monitoring
- Comparison: Log Retention Policies
- 10. Configuring Rack Awareness
- Example: Setting up Rack Awareness
- Key Points
Using MirrorMaker for Replication
- 1. Understanding MirrorMaker Architecture
- Example: MirrorMaker Configuration
- 2. Configuring MirrorMaker 2.0
- Example: Basic MirrorMaker 2.0 Configuration
- 3. Setting Source Cluster
- Example: Source Cluster Configuration
- 4. Setting Target Cluster
- Example: Target Cluster Configuration
- 5. Configuring Topic Replication
- Example: Topic Replication Configuration
- 6. Setting Replication Flow
- Example: Configuring Replication Flow
- 7. Configuring Consumer Groups Sync
- Example: Consumer Group Configuration
- 8. Setting ACLs Replication
- Example: Configure ACLs for Replication
- Example: Set Up Replication with ACLs
- 9. Configuring Heartbeat Connectors
- Example: Heartbeat Configuration
- 10. Monitoring Replication Lag
- Example: Configuring Lag Monitoring in MirrorMaker
Implementing Multi-Datacenter Replication
- 1. Understanding Multi-DC Patterns
- Example: Active-Active Configuration
- 2. Using Cluster Linking
- Example: Configuring Cluster Linking
- Key Features of Cluster Linking
- 3. Configuring Geo-Replication
- Example: Basic Geo-Replication Setup
- 4. Setting Up Disaster Recovery
- Example: Basic disaster recovery configuration
- Disaster Recovery Setup Steps
- 5. Implementing Failover Strategy
- Example: Basic Kafka Failover Configuration
- Failover Strategy Workflow
- Failover vs. Recovery
- Key Failover Considerations
- 6. Configuring Conflict Resolution
- Example: Enabling Unclean Leader Election
- 7. Monitoring Cross-Cluster Lag
- Example: Using Kafka Manager to Monitor Lag
- 8. Using Replicator
- Example: Configuring Replicator
- Key Considerations
- 9. Configuring Network Latency Handling
- Example: Adjusting Replica Lag Time
- 10. Testing Failover Procedures
- Example: Simulating Broker Failure
- Failover Testing Workflow
- Failover Testing Best Practices
Deploying Kafka on Cloud Platforms
- 1. Using Amazon MSK
- Example: Creating MSK Cluster via CLI
- MSK vs Self-Managed Kafka
- 2. Deploying on Confluent Cloud
- Example: Creating a Kafka Cluster on Confluent Cloud
- Example: Configuring Security with Confluent Cloud
- Comparison: Dedicated vs Serverless Clusters
- 3. Using Azure Event Hubs
- Example: Sending Events to Event Hubs
- Example: Reading Events from Event Hubs
- Key Differences from Kafka
- 4. Deploying on Google Cloud
- Example: Creating a Kafka Cluster on Google Cloud
- Deployment Summary
- 5. Configuring Cloud-Specific Settings
- Example: AWS Configuration
- Example: GCP Configuration
- Example: Azure Configuration
- 6. Managing Cloud Kafka Security
- Example: Configuring TLS for Kafka
- Key Security Practices
- 7. Scaling Cloud Kafka Clusters
- Example: Adding a New Broker to AWS MSK Cluster
- Scaling Considerations
- 8. Monitoring Cloud Deployments
- Example: Kafka Cloud Monitoring Setup
- Key Metrics to Monitor
- 9. Optimizing Cloud Costs
- Example: Cost-Optimized Kafka Configuration
- Summary of Cost Optimization Tips
- 10. Implementing Hybrid Cloud Setup
- Example: Kafka Cluster Configuration for Hybrid Cloud
- Hybrid Cloud Deployment Considerations
Capacity Planning and Sizing
- 1. Estimating Message Throughput
- Example: Throughput Calculation
- 2. Calculating Partition Count
- Example: Estimating Partition Count
- Partition Count Best Practices
- 3. Sizing Broker Hardware
- Example: Broker Memory Configuration
- Key Considerations
- 4. Estimating Storage Requirements
- Example: Storage Calculation
- 5. Planning Network Bandwidth
- Example: Producer Bandwidth Calculation
- 6. Determining Replication Factor
- Example: Setting Replication Factor
- 7. Sizing Consumer Groups
- Example: Consumer Group Configuration
- Consumer Group Sizing Guidelines
- 8. Planning for Peak Load
- Example: Peak Load Calculation
- Peak Load Planning Steps
- Key Metrics for Peak Load
- 9. Configuring Retention Policies
- Example: Setting Retention Policies
- 10. Monitoring Resource Utilization
- Example: Kafka Broker CPU Usage Monitoring
- Example: Memory Usage with JConsole
Testing Kafka Applications
- 1. Using EmbeddedKafka
- Example: Using EmbeddedKafka with JUnit 4
- Example: Using EmbeddedKafka with JUnit 5
- 2. Creating Test Producer
- Example: Basic Test Producer Setup
- Example: Sending a Test Message
- 3. Creating Test Consumer
- Example: Basic Test Consumer Setup
- 4. Testing Streams Topology
- Example: Basic Kafka Streams Test
- Key Concepts
- 5. Mocking External Dependencies
- Example: Using Mockito to Mock Kafka Producer
- Best Practices for Mocking Kafka
- 6. Testing Serialization
- Example: String Serialization
- Example: JSON Serialization
- 7. Testing Error Scenarios
- Example: Simulating Producer Failures
- Example: Testing Consumer Retry Logic
- 8. Integration Testing
- Example: Integration Test Setup with Embedded Kafka
- Best Practices for Integration Testing
- 9. Performance Testing
- Example: Measuring Throughput
- Example: Latency Measurement
- 10. Load Testing
- Example: Kafka Load Test Configuration
- Load Testing Best Practices
Debugging and Troubleshooting
- 1. Enabling Debug Logging
- Example: Kafka Server Debug Logging Configuration
- 2. Using Broker Logs
- Example: Log Configuration
- Example: Log Rotation
- Key Log Categories
- 3. Checking Controller Logs
- Example: Controller Log Configuration
- Key Log Fields to Monitor
- 4. Analyzing State Change Logs
- Example: Parsing State Change Logs
- Key Points
- 5. Using Kafka Dump Log Tool
- Example: Dumping a Kafka log segment
- 6. Checking Topic Metadata
- Example: Describe Topic Metadata
- Example: List All Topics
- 7. Analyzing Consumer Lag
- Example: Consumer Lag Monitoring Script
- 8. Using JMX Console
- Example: Connecting to Kafka via JMX
- Example: Monitoring Consumer Lag via JMX
- Key JMX MBeans for Kafka
- 9. Tracing Request Path
- Example: Kafka Producer Trace
- 10. Debugging Rebalance Issues
- Example: Consumer Lag Check
Implementing Backup and Recovery
- 1. Understanding Backup Strategies
- Example: Full Backup Command Using Kafka Tools
- 2. Backing Up Topic Data
- Example: Configuring Log Retention
- Backup Strategy Summary
- 3. Backing Up Consumer Offsets
- Example: Exporting Consumer Offsets
- Example: Importing Consumer Offsets
- 4. Backing Up Schemas
- Example: Fetching a Schema by ID
- Example: Listing All Subjects
- 5. Backing Up Configuration
- Example: Backing Up Topic Configurations
- 6. Implementing Point-in-Time Recovery
- Example: Configuring Point-in-Time Recovery
- Key Considerations for PITR
- 7. Restoring from Backup
- Example: Restore a Kafka Topic from Backup
- 8. Recovering Consumer Groups
- Example: Consumer Group Recovery Configuration
- Recovery Steps
- 9. Testing Recovery Procedures
- Example: Basic Recovery Test Setup
- Recovery Test Procedure
- 10. Automating Backup Process
- Example: Kafka Backup Script
- Backup Automation Steps