- Broker
- Source topic
- Sink topic
- Producer - push data into Source Topic
- Broker with ZooKeeper or KRaft
Note: could not get this method to work consistently. Going with KRaft route (see below)
$ $KAFKA_HOME/bin/zookeeper-server-start.sh $KAFKA_HOME/config/zookeeper.properties
$ $KAFKA_HOME/bin/kafka-server-start.sh $KAFKA_HOME/config/server.properties
Generate a Cluster UUID (Do this one time)
$ KAFKA_CLUSTER_ID="$($KAFKA_HOME/bin/kafka-storage.sh random-uuid)"
Format Log Directories (Do this one time)
$ $KAFKA_HOME/bin/kafka-storage.sh format -t $KAFKA_CLUSTER_ID \
-c $KAFKA_HOME/config/kraft/server.properties
Start the Kafka server
$ $KAFKA_HOME/bin/kafka-server-start.sh $KAFKA_HOME/config/kraft/server.properties
- Source topic (Do this one time)
$ $KAFKA_HOME/bin/kafka-topics.sh --create \
--bootstrap-server localhost:9092 \
--replication-factor 1 \
--partitions 1 \
--topic streams-plaintext-input
- Sink topic (Do this one time)
$ $KAFKA_HOME/bin/kafka-topics.sh --create \
--bootstrap-server localhost:9092 \
--replication-factor 1 \
--partitions 1 \
--topic streams-wordcount-output
#--topic streams-linesplit-output
#--topic streams-pipe-output
- Producer - push data into Source Topic
$ $KAFKA_HOME/bin/kafka-console-producer.sh \
--bootstrap-server localhost:9092 \
--topic streams-plaintext-input
- Consumer - for use with Wordcount Streams app
$ $KAFKA_HOME/bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 \
--topic streams-wordcount-output \
--from-beginning \
--property print.key=true \
--property print.value=true \
--property key.deserializer=org.apache.kafka.common.serialization.StringDeserializer \
--property value.deserializer=org.apache.kafka.common.serialization.LongDeserializer