kafka客户端常用命令
kafka-topics.sh 相关的命令
Command Usage:
create:(图片来源网络,侵删)
enable rack strategy:
kafka-topics.sh --create --topic --partitions --replication-factor --zookeeper
disable rack strategy:
kafka-topics.sh --create --topic --partitions --replication-factor --zookeeper --disable-rack-aware
delete:
kafka-topics.sh --delete --topic --zookeeper
alter:
kafka-topics.sh --alter --topic --zookeeper --config
list:
kafka-topics.sh --list --zookeeper
describe:
kafka-topics.sh --describe --zookeeper
示例:
kafka-topics.sh --create --topic TPCLOUD004 --partitions 10 --replication-factor 2 --zookeeper whtpiodscshd01t:24002/kafka
kafka-topics.sh --list --zookeeper whtpiodscshd01t:24002/kafka
kafka-topics.sh --describe --zookeeper whtpiodscshd01t:24002/kafka
kafka-topics.sh --delete --topic TPCLOUD004 --zookeeper whtpiodscshd01t:24002/kafka
kafka-console-producer.sh 相关的命令
Command Usage:
old-producer:
kafka-console-producer.sh --broker-list --topic --old-producer --sync
new-producer:
kafka-console-producer.sh --broker-list --topic --producer.config
示例:
kafka-console-producer.sh --broker-list 10.22.33.10:21007,10.22.33.11:21007,10.22.33.12:21007 --topic test
kafka-console-consumer.sh 相关的命令
Command Usage:
old-consumer:
kafka-console-consumer.sh --zookeeper --topic --from-beginning
new-consumer:
kafka-console-consumer.sh --topic --bootstrap-server --consumer.config
示例:
kafka-console-consumer.sh
–topic rt_flink
–bootstrap-server 10.22.33.10:21007,10.22.33.11:21007,10.22.33.12:21007
–from-beginning
kafka-consumer-groups.sh 相关的命令
Command Usage:
list:
kafka-consumer-groups.sh --list --zookeeper
kafka-consumer-groups.sh --list --bootstrap-server --command-config
describe:
kafka-consumer-groups.sh --describe --zookeeper --group
kafka-consumer-groups.sh --describe --bootstrap-server --group --command-config
示例:
kafka-consumer-groups.sh --zookeeper whtpiodscshd01t:24002/kafka --list
kafka-consumer-groups.sh --describe --zookeeper whtpiodscshd01t:24002/kafka --group example-group1