Adding Kafka docker-compose script for kraft
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
=== Kafka Cluster
|
||||
Runs a multi-node Kafka cluster w/ 3 brokers available at `locahost:9091,localhost:9092,localhost:9093`.
|
||||
|
||||
To start the brokers run the following command:
|
||||
To start the brokers using zookeeper for leader election, run the following command:
|
||||
[source,shell]
|
||||
----
|
||||
docker-compose -f ./kafka-cluster.yml up
|
||||
@@ -17,6 +17,8 @@ docker-compose -f ./kafka-cluster.yml down
|
||||
|
||||
TIP: To start the containers in the foreground simply add `-d` to the start command. To stop containers that are running in the foreground simple issue `CTRL-C` command.
|
||||
|
||||
To start a single node Kafka cluster using the `kraft` protocol, use the `kraft.yml` file instead.
|
||||
|
||||
Running a quick test:
|
||||
|
||||
Now that we started our clusters, let us try to produce data to a topic on the cluster and then consume from it.
|
||||
|
||||
29
tools/kafka/docker-compose/kraft.yml
Normal file
29
tools/kafka/docker-compose/kraft.yml
Normal file
@@ -0,0 +1,29 @@
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
|
||||
kafka:
|
||||
image: apache/kafka:latest
|
||||
container_name: kafka
|
||||
hostname: kafka
|
||||
ports:
|
||||
- "9092:9092"
|
||||
- "9101:9101"
|
||||
environment:
|
||||
KAFKA_NODE_ID: 1
|
||||
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: 'CONTROLLER:PLAINTEXT,PLAINTEXT_DOCKER:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT'
|
||||
KAFKA_LISTENERS: 'PLAINTEXT_DOCKER://kafka:29092,CONTROLLER://kafka:29093,PLAINTEXT_HOST://0.0.0.0:9092'
|
||||
KAFKA_ADVERTISED_LISTENERS: 'PLAINTEXT_DOCKER://kafka:29092,PLAINTEXT_HOST://localhost:9092'
|
||||
KAFKA_NUM_PARTITIONS: 10
|
||||
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
|
||||
KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'true'
|
||||
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
|
||||
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
|
||||
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
|
||||
KAFKA_JMX_PORT: 9101
|
||||
KAFKA_JMX_HOSTNAME: localhost
|
||||
KAFKA_PROCESS_ROLES: 'broker,controller'
|
||||
KAFKA_CONTROLLER_QUORUM_VOTERS: '1@kafka:29093'
|
||||
KAFKA_INTER_BROKER_LISTENER_NAME: 'PLAINTEXT_DOCKER'
|
||||
KAFKA_CONTROLLER_LISTENER_NAMES: 'CONTROLLER'
|
||||
KAFKA_LOG_DIRS: '/tmp/kraft-combined-logs'
|
||||
Reference in New Issue
Block a user