Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
49 views1 page

Kafka Commands 1

The document provides instructions for starting ZooKeeper and Kafka servers, creating a Kafka topic, and producing and consuming messages. It also details log storage locations, log file inspection commands, and Kafka's retention policies. Additionally, it includes Maven commands for building and running a Spring Boot application.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views1 page

Kafka Commands 1

The document provides instructions for starting ZooKeeper and Kafka servers, creating a Kafka topic, and producing and consuming messages. It also details log storage locations, log file inspection commands, and Kafka's retention policies. Additionally, it includes Maven commands for building and running a Spring Boot application.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

Make sure ZooKeeper and Kafka servers are running before executing these commands

(ZooKeeper on localhost:2181 by default, Kafka on localhost:9092

D:\kafka_2.13-3.9.1\bin\windows\zookeeper-server-start D:\kafka_2.13-3.9.1\config\
zookeeper.properties

D:\kafka_2.13-3.9.1\bin\windows\kafka-server-start D:\kafka_2.13-3.9.1\config\
server.properties

D:\kafka_2.13-3.9.1\bin\windows>kafka-topics --create --bootstrap-server


localhost:9092 --replication-factor 1 --partitions 1 --topic rakesh-tpc

D:\kafka_2.13-3.9.1\bin\windows>kafka-console-producer --bootstrap-server
localhost:9092 --topic rakesh-tpc
>hai
>123

D:\kafka_2.13-3.9.1\bin\windows>kafka-console-consumer.bat --bootstrap-server
localhost:9092 --topic rakesh-tpc
hello
hai
123

logs-storage
1) \tmp\zookeeper\version-2
2) /tmp/kafka-logs

Kafka organizes logs in the log.dirs directory as subdirectories named topicName-


partitionNumber

Inspect the Log File -


D:\kafka_2.13-3.9.1\bin\windows\kafka-dump-log.bat --files D:\tmp\kafka-logs\
rakesh-tpc-0\00000000000000000000.log --print-data-log

D:\kafka_2.13-3.9.1\bin\windows\kafka-dump-log.bat --files D:\tmp\kafka-logs\


rakesh-test-tpc-0\00000000000000000000.log --print-data-log

>D:\kafka_2.13-3.9.1\bin\windows\kafka-dump-log.bat --files D:\Java-Details\kafka-


demo\kafka-logs\rakesh-test-1-tpc-0\00000000000000000000.log --print-data-log

Kafka’s retention policies:


Check log.retention.hours or log.retention.ms in server.properties (default is 168
hours, or 7 days).
Check log.retention.bytes for size-based retention (default is -1, meaning no size
limit

mvn clean install

mvn spring-boot:run

You might also like