Kafka常用命令

scala下载
https://distfiles.macports.org/scala2.12/
查询Kafka版本

sh kafka-topics.sh --version

linux环境启动kafka
1.先启动zk

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

2.再启动Kafka

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

3.查询Topic列表

./bin/kafka-topics.sh --bootstrap-server 127.0.0.1:9092 --list --exclude-internal

4.创建topic

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

5.发送消息

kafka-console-producer.sh --broker-list localhost:9092 --topic <topic>

6.查看kakfa主题消费情况

./bin/kafka-consumer-groups.sh --bootstrap-server <bootstrap_servers> --group <consumer_group_id> --describe

7.查看指定topic

./bin/kafka-topics.sh --bootstrap-server broker_host:port --describe --topic <topic_name>

windows环境
1.启动zookeeper

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

2.启动Kafka

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

3.查看主题的详情

.\bin\windows\kafka-topics.bat --bootstrap-server localhost:9092 --describe --topic <topic_name>

4.发送消息

kafka-console-producer.bat --broker-list ip:9092 --topic <topic>

5.接受消息

kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic test --from-beginning
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值