kafka

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

关闭 zookeeper
./bin/zookeeper-server-stop.sh -daemon ./config/zookeeper.properties

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

停止 kafka
./bin/kafka-server-stop.sh ./config/server.properties

创建 topic
./bin/kafka-topics.sh --create --zookeeper localhost:2181/kafka --replication-factor 1 --partitions 1 --topic test
Created topic test.
查看 topic
./bin/kafka-topics.sh --list --zookeeper localhost:2181/kafka
test

发送消息
./bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test

接收消息
./bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning

./bin/kafka-topics.sh --zookeeper localhost:2181/kafka --describe --topic test
Topic: test PartitionCount: 1 ReplicationFactor: 1 Configs:
Topic: test Partition: 0 Leader: 0 Replicas: 0 Isr: 0

./bin/kafka-topics.sh --zookeeper localhost:2181/kafka --delete --topic test
Topic test is marked for deletion.
Note: This will have no impact if delete.topic.enable is not set to true.

idea 调试 kafka 源码

  1. git clone https://github.com/apache/kafka.git
  2. 进入kafka目录执行:./gradlew build
  3. 使用idea打开 kafka 源码目录
  4. 将 kafka/config/log4j.properties copy 到 /kafka/core/src/main/resources
  5. project(’:core’) dependencies 增加 implementation libs.slf4jlog4j 否则找不到 SLF4J
  6. 在这里插入图片描述

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

N3verL4nd

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值