Kafka学习
Kafka学习
https://blog.csdn.net/Eternal_Blue/article/details/95598942
https://www.cnblogs.com/swordfall/p/10014300.html
常用命令
启停
开启zookeeper:
./zkServer.sh start关闭zookeeper: ./zkServer.sh stop
查看zookeeper的启动状态:
./zkServer.sh status
Kafka启动命令常规模式启动
./bin/kafka-server-start.sh config/server.properties
进程守护模式启动kafka:
nohup ./bin/kafka-server-start.sh config/server.properties &
or
nohup bin/kafka-server-start.sh config/server.properties >/dev/null 2>&1 &
nohup /data/kafka_2.12-2.3.0/bin/kafka-server-start.sh /data/kafka_2.12-2.3.0/config/server.properties & 或 /data/kafka_2.12-2.3.0/bin/kafka-server-start.sh -daemon /data/kafka_2.12-2.3.0/config/server.properties
Kafka关闭命令: bin/kafka-server-stop.sh
消息的生产和消费
需要设置hosts localhost ip
创建topic:
./bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test_gorv
查看topic:./bin/kafka-topics.sh --list --zookeeper localhost:2181
生产消息:./bin/kafka-console-producer.sh --broker-list localhost:9092 --topic
消费消息:sh bin/kafka-console-consumer.sh --bootstrap-server 127.0.0.1:9092 --topic testTopic --from-beginning
kafka命令:
创建topic:sh bin/kafka-topics.sh --create --bootstrap-server 127.0.0.1:9092 --replication-factor 1 --partitions 1 --topic testTopic2
查看topic:sh bin/kafka-topics.sh --list --bootstrap-server 127.0.0.1:9092
生产消息:sh bin/kafka-console-producer.sh --broker-list 127.0.0.1:9092 --topic testfy
消费消息:sh bin/kafka-console-consumer.sh --bootstrap-server 127.0.0.1:9092 --topic testfy2 --from-beginning
删除topic:./bin/kafka-topics.sh --delete --topic test_gov_serv --zookeeper 127.0.0.1:2181
清空消息:./bin/kafka-topics.sh --bootstrap-server 127.0.0.1:9092 --delete --topic fytestTopic
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)
2018-06-19 android项目中遇到的杂七杂八问题