-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Instant kraft demo #1124
base: 7.2.1-post
Are you sure you want to change the base?
WIP: Instant kraft demo #1124
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Instant KRaft Demo | ||
Let's make some delicious instant KRaft | ||
___ | ||
.'O o'-._ | ||
/ O o_.-`| | ||
/O_.-' O | | ||
|O o O .-` | ||
|o O_.-' | ||
'--` | ||
|
||
## Step 1 | ||
``` | ||
$ git clone https://github.com/confluentinc/examples.git && cd examples/instant-kraft | ||
|
||
$ docker compose up | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For better or worse, our examples seem to usually use Up to you whether you want the |
||
``` | ||
|
||
That's it! One container, one process, doing the the broker and controller work. No Zookeeper. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think ZooKeeper (camel case) is standard. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Remove duplicate "the" and reword. Maybe
|
||
The key server configure to enable KRaft is the `process.roles`. Here we have the same node doing both the broker and quorum conroller work. Note that this is ok for local development, but in production you should have seperate nodes for the broker and controller quorum nodes. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Needs rewording. The key server configuration for enabling KRaft is |
||
|
||
``` | ||
KAFKA_PROCESS_ROLES: 'broker,controller' | ||
``` | ||
|
||
## Step 2 | ||
Start streaming | ||
|
||
``` | ||
$ docker compose exec broker kafka-topics --create --topic zookeeper-vacation-ideas --bootstrap-server localhost:9092 | ||
|
||
$ docker-compose exec broker kafka-producer-perf-test --topic zookeeper-vacation-ideas \ | ||
Comment on lines
+29
to
+31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Commands used include both Maybe we should stick to one. I think our formal docs lean towards |
||
--num-records 200000 \ | ||
--record-size 50 \ | ||
--throughput -1 \ | ||
--producer-props \ | ||
acks=all \ | ||
bootstrap.servers=localhost:9092 \ | ||
compression.type=none \ | ||
batch.size=8196 | ||
``` | ||
|
||
## Step 3 | ||
Explore the cluster using the new kafka metadata command line tool. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we refer to it inline by name? I don't mind, just asking: |
||
|
||
``` | ||
$ docker-compose exec broker kafka-metadata-shell --snapshot /tmp/kraft-combined-logs/__cluster_metadata-0/00000000000000000000.log | ||
|
||
# use the metadata shell to explore the quorum | ||
>> ls metadataQuorum | ||
|
||
>> cat metadataQuorum/leader | ||
``` | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we mention CTRL-D to exit the REPL? |
||
Note: the `update_run.sh` is to get around some checks in the cp-kafka docker image. There are plans to change those checks in the future. | ||
|
||
The scipt also formats the storage volumes with a random uuid for the cluster. Formatting kafka storage is very important in production environments. See the AK documentation for more information. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
version: '2' | ||
services: | ||
broker: | ||
image: confluentinc/cp-kafka:latest | ||
hostname: broker | ||
container_name: broker | ||
ports: | ||
- "9092:9092" | ||
- "9101:9101" | ||
environment: | ||
KAFKA_BROKER_ID: 1 | ||
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: 'CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT' | ||
KAFKA_ADVERTISED_LISTENERS: 'PLAINTEXT://broker:29092,PLAINTEXT_HOST://localhost:9092' | ||
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 | ||
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_NODE_ID: 1 | ||
KAFKA_CONTROLLER_QUORUM_VOTERS: '1@broker:29093' | ||
KAFKA_LISTENERS: 'PLAINTEXT://broker:29092,CONTROLLER://broker:29093,PLAINTEXT_HOST://0.0.0.0:9092' | ||
KAFKA_INTER_BROKER_LISTENER_NAME: 'PLAINTEXT' | ||
KAFKA_CONTROLLER_LISTENER_NAMES: 'CONTROLLER' | ||
KAFKA_LOG_DIRS: '/tmp/kraft-combined-logs' | ||
volumes: | ||
- ./update_run.sh:/tmp/update_run.sh | ||
command: "bash -c 'if [ ! -f /tmp/update_run.sh ]; then echo \"ERROR: Did you forget the update_run.sh file that came with this docker-compose.yml file?\" && exit 1 ; else /tmp/update_run.sh && /etc/confluent/docker/run ; fi'" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/sh | ||
|
||
# Docker workaround: Remove check for KAFKA_ZOOKEEPER_CONNECT parameter | ||
sed -i '/KAFKA_ZOOKEEPER_CONNECT/d' /etc/confluent/docker/configure | ||
|
||
# Docker workaround: Ignore cub zk-ready | ||
sed -i 's/cub zk-ready/echo ignore zk-ready/' /etc/confluent/docker/ensure | ||
|
||
# KRaft required step: Format the storage directory with a new cluster ID | ||
echo "kafka-storage format --ignore-formatted -t $(kafka-storage random-uuid) -c /etc/kafka/kafka.properties" >> /etc/confluent/docker/ensure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might need to be in a code block to appear proper cheesy.