v3.5.0
,v3.5
,latest
v3.4.1
,v3.4
v3.3.2
,v3.3
- More Tags
Apache Kafka is an open-source distributed event streaming platform used by thousands of companies for high-performance data pipelines, streaming analytics, data integration, and mission-critical applications.
More than 80% of all Fortune 100 companies trust, and use Kafka.
- Fully compatible with
KRaft
, say goodbye to ZooKeeper. - Flexible use of environment variables for configuration.
- Easy to deploy.
- Provide helm chart, you can quickly deploy high-availability clusters on Kubernetes.
Starting a Kafka instance is simple:
docker run -d --name kafka-server --network host sir5kong/kafka
docker volume create kafka-data
docker run -d --name kafka-server \
--network host \
-v kafka-data:/opt/kafka/data \
sir5kong/kafka
The default listener port of the broker is
9092
docker volume create kafka-data
docker run -d --name kafka-server \
--network host \
-v kafka-data:/opt/kafka/data \
--env KAFKA_CONTROLLER_LISTENER_PORT=29091 \
--env KAFKA_BROKER_LISTENER_PORT=29092 \
sir5kong/kafka
version: "3"
volumes:
kafka-data: {}
## bootstrap-server: ${KAFKA_HOST_IP_ADDR}:9092
services:
kafka:
image: sir5kong/kafka:v3.5
restart: always
network_mode: host
volumes:
- kafka-data:/opt/kafka/data
environment:
- KAFKA_HEAP_OPTS=-Xmx512m -Xms512m
#- KAFKA_CONTROLLER_LISTENER_PORT=19091
#- KAFKA_BROKER_LISTENER_PORT=9092
Variable | Default | Description |
---|---|---|
KAFKA_CLUSTER_ID |
Random | Cluster ID |
KAFKA_BROKER_LISTENER_PORT |
9092 |
broker listener port. This will not work if KAFKA_CFG_LISTENERS is configured |
KAFKA_CONTROLLER_LISTENER_PORT |
19091 |
controller listener port. This will not work if KAFKA_CFG_LISTENERS is configured |
KAFKA_HEAP_OPTS |
null |
Kafka Java Heap size. For example -Xmx512m -Xms512m |
Any environment variable beginning with KAFKA_CFG_
will be mapped to its corresponding Apache Kafka key.
For example, use KAFKA_CFG_LISTENERS
in order to set listeners
or KAFKA_CFG_ADVERTISED_LISTENERS
in order to configure advertised.listeners
.
Variable examples:
Variable | Key |
---|---|
KAFKA_CFG_PROCESS_ROLES |
process.roles |
KAFKA_CFG_LISTENERS |
listeners |
KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP |
listener.security.protocol.map |
KAFKA_CFG_ADVERTISED_LISTENERS |
advertised.listeners |
KAFKA_CFG_CONTROLLER_QUORUM_VOTERS |
controller.quorum.voters |
KAFKA_CFG_LOG_RETENTION_HOURS |
log.retention.hours |
log.dir
andlog.dirs
are locked, you cannot overwrite them
- Kubernetes 1.18+
- Helm 3.3+
helm repo add kafka-repo https://helm-charts.itboon.top/kafka
helm repo update kafka-repo
- Turn off persistent storage here, only demonstrate the deployment operation
helm upgrade --install kafka \
--namespace kafka-demo \
--create-namespace \
--set broker.combinedMode.enabled="true" \
--set broker.persistence.enabled="false" \
kafka-repo/kafka
helm upgrade --install kafka \
--namespace kafka-demo \
--create-namespace \
--set broker.persistence.size="20Gi" \
kafka-repo/kafka
Persistence storage is used by default.
helm upgrade --install kafka \
--namespace kafka-demo \
--create-namespace \
--set controller.replicaCount="3" \
--set broker.replicaCount="3" \
--set broker.heapOpts="-Xms4096m -Xmx4096m" \
--set broker.resources.requests.memory="8Gi" \
--set broker.resources.limits.memory="16Gi" \
kafka-repo/kafka
More values please refer to examples/values-production.yml
Enable Kubernetes external cluster access to Kafka brokers.
helm upgrade --install kafka \
--namespace kafka-demo \
--create-namespace \
--set broker.external.enabled="true" \
--set broker.external.service.type="LoadBalancer" \
--set broker.external.domainSuffix="kafka.example.com" \
kafka-repo/kafka
Configure your DNS record to complete this deployment.