Kakfa使用相关

一、启动

1.zookeeper后台启动  nohup bin/zookeeper-server-start.sh config/zookeeper.properties &

2.kafka后台启动  nohup bin/kafka-server-start.sh config/server.properties &

 windows:

.\bin\windows\zookeeper-server-start.bat .\config\zookeeper.properties

.\bin\windows\kafka-server-start.bat .\config\server.properties

 

二、使用

1.查询topic列表  bin/kafka-topics.sh --list --bootstrap-server localhost:9020

2.删除topic        bin/kafka-topics.sh --bootstrap-server localhost:9020 --delete --topic TopicName 

3.查询指定topic内的消息  bin/kafka-console-consumer.sh --bootstrap-server localhost:9020 --topic TopicName --from-beginning

4.查询group列表  ./bin/kafka-consumer-groups.sh --bootstrap-server localhost:9020 --list

5.查询指定group的消费情况  ./bin/kafka-consumer-groups.sh --describe --bootstrap-server localhost:9020 --group GroupName

6.修改指定topic的partion  ./bin/kafka-topics.sh --bootstrap-server localhost:9020 --alter --topic TopicName --partitions N

 

三、生产与消费

1.生产消息         bin/kafka-console-producer.sh --broker-list localhost:9092 --topic TopicName 

2.消费消息         bin/kafka-console-consumer.sh --bootstrap-server localhost:9020 --from-beginning --topic TopicName 

四、调用flume

bin/flume-ng agent --conf conf/ --conf-file job/flume-taildir-kafka.conf --name agent -Dflume.root.logger=INFO,console -Dflume.monitoring.type=http -Dflume.monitoring.port=9888 &

posted @ 2020-11-04 11:12  xmalll  阅读(109)  评论(0)    收藏  举报