Skip to content

Instantly share code, notes, and snippets.

@bijay-shrestha
Last active May 26, 2024 04:00
Show Gist options
  • Save bijay-shrestha/e2563dd5616e579bbb07518475fa2f13 to your computer and use it in GitHub Desktop.
Save bijay-shrestha/e2563dd5616e579bbb07518475fa2f13 to your computer and use it in GitHub Desktop.
These are kafka commands

Open Source Kafka Startup in local

Start Zookeeper Server

sh bin/zookeeper-server-start.sh config/zookeeper.properties

Start Kafka Server / Broker

sh bin/kafka-server-start.sh config/server.properties

Create topic

sh bin/kafka-topics.sh --bootstrap-server localhost:9092 --create --topic NewTopic --partitions 3 --replication-factor 1

list out all topic names

sh bin/kafka-topics.sh --bootstrap-server localhost:9092 --list

Describe topics

sh bin/kafka-topics.sh --bootstrap-server localhost:9092 --describe --topic NewTopic

Produce message

sh bin/kafka-console-producer.sh --broker-list localhost:9092 --topic NewTopic

consume message

sh bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic NewTopic --from-beginning

Confluent Kafka Community Edition in local

Start Zookeeper Server

bin/zookeeper-server-start etc/kafka/zookeeper.properties

Start Kafka Server / Broker

bin/kafka-server-start etc/kafka/server.properties

Create topic

bin/kafka-topics --bootstrap-server localhost:9092 --create --topic NewTopic1 --partitions 3 --replication-factor 1

list out all topic names

bin/kafka-topics --bootstrap-server localhost:9092 --list

Describe topics

bin/kafka-topics --bootstrap-server localhost:9092 --describe --topic NewTopic1

Produce message

bin/kafka-console-producer --broker-list localhost:9092 --topic NewTopic1

consume message

bin/kafka-console-consumer --bootstrap-server localhost:9092 --topic NewTopic1 --from-beginning

Send CSV File data to kafka

bin/kafka-console-producer --broker-list localhost:9092 --topic NewTopic1 <bin/customers.csv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment