Kafka常用命令大全

2021-10-10 11:51:56 字數 1619 閱讀 8964

kafka-server-

start

.sh -daemon /usr/local/kafka_2.13-2.6.0/config/server.properties

kafka-server-stop.sh
.

/kafka-topics.sh --list --zookeeper 192.168.25.132:2181

.

/kafka-topics.sh --describe --zookeeper 192.168.25.132:2181

.

/kafka-topics.sh --zookeeper 192.168.25.132:2181 --alter --topic test --partitions 10

.

/kafka-topics.sh --describe --zookeeper 192.168.25.132:2181 --topic test

.

/kafka-topics.sh --zookeeper 192.168.25.132:2181 --delete --topic test

.

/kafka-topics.sh --zookeeper 192.168.25.132:2181 --create --topic test --replication-factor 1 --partitions 3

.

/kafka-console-producer.sh --broker-list 192.168.25.132:9092 --topic test

#--from-beginning表示從最開始第一條開始消費,不加表示從最新一條開始

./kafka-console-consumer.sh --bootstrap-server 192.168.25.132:9092 --topic test --

from

-beginning

.

/kafka-run-

class

.sh kafka.tools.getoffsetshell --broker-list 192.168.25.132:9092 --topic test --time -1

.

/kafka-consumer-groups.sh --bootstrap-server 192.168.25.132:9092 --list

#console-consumer-34389 從上乙個命令獲取

./kafka-consumer-groups.sh --describe --

group console-consumer-34389 --bootstrap-server 192.168.25.132:9092

注意:如果在docker執行命令,需要加上根目錄字首,例如:$/bin/kafka-topics.sh ******

kafka常用命令

kafka常用操作命令 l檢視當前伺服器中的所有topic bin kafka topics.sh list zookeeper hadoop02 2181 l建立topic kafka topics.sh create zookeeper hadoop02 2181 replication fac...

kafka常用命令

啟動集群 nohup bin kafka server start.sh config server.properties 建立topic kafka topics topictt replication factor3 partitions3 create zookeeper hadoop1 21...

Kafka 常用命令

kafka console producer broker list 127.0.0.1 9092 topic mytopic kafka console consumer bootstrap server 127.0.0.1 9092 topic mytopic 建立主題,replication ...