-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApacheKafka CLI Commands.sh
More file actions
39 lines (25 loc) · 1.1 KB
/
ApacheKafka CLI Commands.sh
File metadata and controls
39 lines (25 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
############################
##ApacheKafka CLI Commands##
############################
#### Broker
# start zookeeper cluster
bin/zookeeper-server-start.sh config/zookeeper.properties
# start kafka cluster
bin/kafka-server-start.sh config/server.properties
#### Topic
# create a topic
bin/kafka-topics.sh --zookeeper localhost:2181 --topic firstTopic --create --partitions 3 --replication-factor 1
# describe topics
bin/kafka-topics.sh --zookeeper localhost:2181 --describe
#### Producer
# create/launch a producer
bin/kafka-console-producer.sh --broker-list localhost:9092 --topic firstTopic
#### Consumer
# create a consumer
bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic firstTopic --from-beginning
# create/launch a consumer group
bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --group firstConsumerGroup
# list consumer groups
bin/kafka-consumer-groups.sh --bootstrap-server localhost:9092 --list
# reset offsets
bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --group firstConsumerGroup --topic firstTopic --reset-offsets --shift-by 2 --execute