Usage & Enterprise Capabilities
Key Benefits
- High Throughput: Handles millions of messages per second.
- Fault Tolerant: Replication ensures durability and reliability.
- Horizontally Scalable: Add brokers and partitions seamlessly.
- Event-Driven Architecture: Enables real-time microservices communication.
- Production-Ready Security: TLS, SASL authentication, and ACL authorization.
Production Architecture Overview
- Kafka Brokers: Core servers that store and serve data.
- Controller (KRaft) or ZooKeeper Ensemble: Manages cluster metadata.
- Producers: Applications publishing events.
- Consumers: Applications subscribing to topics.
- Kafka Connect: Integrates external systems.
- Kafka Streams: Real-time stream processing.
- Load Balancer: Distributes client traffic.
- Monitoring Stack: Prometheus + Grafana.
- Backup Strategy: Replication and off-cluster data export.
Implementation Blueprint
Implementation Blueprint
Prerequisites
sudo apt update && sudo apt upgrade -y
sudo apt install docker.io docker-compose -y
sudo systemctl enable docker
sudo systemctl start dockersudo sysctl -w fs.file-max=100000
echo "fs.file-max=100000" | sudo tee -a /etc/sysctl.confDocker Compose (Single Broker - Production Testing)
version: "3.8"
services:
kafka:
image: bitnami/kafka:latest
container_name: kafka
restart: always
ports:
- "9092:9092"
environment:
- KAFKA_ENABLE_KRAFT=yes
- KAFKA_CFG_NODE_ID=1
- KAFKA_CFG_PROCESS_ROLES=broker,controller
- KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER
- KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093
- KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://localhost:9092
- KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=1@localhost:9093
- ALLOW_PLAINTEXT_LISTENER=yes
volumes:
- ./kafka-data:/bitnami/kafkadocker-compose up -d
docker psdocker exec -it kafka kafka-topics.sh --create \
--topic test-topic \
--bootstrap-server localhost:9092 \
--replication-factor 1 \
--partitions 3Multi-Broker Production Cluster (Recommended)
- Minimum 3 brokers
- Replication factor ≥ 3
- Multiple partitions per topic
- Separate disks for log storage
- KRaft mode (no ZooKeeper) or 3-node ZooKeeper ensemble
broker.id=1
listeners=PLAINTEXT://:9092
advertised.listeners=PLAINTEXT://broker1:9092
log.dirs=/var/lib/kafka/logs
num.partitions=6
default.replication.factor=3
min.insync.replicas=2Scaling Strategy
- Increase partitions to improve parallelism.
- Add brokers to distribute load.
- Use rack awareness for multi-zone deployments.
- Separate controller and broker roles in large clusters.
- Deploy via Kubernetes StatefulSets for automated scaling.
Reverse Proxy & TLS Termination
listeners=SSL://:9093
ssl.keystore.location=/var/private/ssl/kafka.keystore.jks
ssl.keystore.password=changeit
ssl.truststore.location=/var/private/ssl/kafka.truststore.jks
ssl.truststore.password=changeitBackup & Data Retention Strategy
log.retention.hours=168
log.segment.bytes=1073741824- MirrorMaker 2 for cross-cluster replication
- Kafka Connect to S3 or object storage
- Periodic export to data warehouse
Monitoring & Observability
- Prometheus JMX Exporter
- Grafana dashboards
- Kafka Manager / Cruise Control
- Alerts for:
- Under-replicated partitions
- Broker unavailability
- High consumer lag
- Disk usage > 75%
KAFKA_OPTS="-javaagent:/opt/jmx_prometheus_javaagent.jar=7071:/opt/config.yml"Security Best Practices
- Enable TLS encryption for client and inter-broker communication.
- Configure SASL authentication (SCRAM or OAuth).
- Enforce ACLs for topic access control.
- Restrict broker network exposure (private VPC only).
- Enable audit logging.
- Regularly update Kafka versions and security patches.
High Availability Checklist
- Minimum 3 brokers
- Replication factor ≥ 3
- min.insync.replicas ≥ 2
- Multi-AZ deployment
- Dedicated SSD storage
- Automated monitoring & alerting
- Tested disaster recovery plan
Recommended Hosting for Apache Kafka
For systems like Apache Kafka, we recommend high-performance VPS hosting. Hostinger offers dedicated setups for open-source tools with one-click installer scripts and 24/7 priority support.
Get Started on HostingerExplore Alternative Tools Infrastructure
Kubernetes
Kubernetes is a production-grade, open-source platform for automating deployment, scaling, and operations of application containers.
Supabase
Supabase is the leading open-source alternative to Firebase. It provides a full backend-as-a-service (BaaS) powered by PostgreSQL, including authentication, real-time subscriptions, and storage.