Skip to content

Commit

Permalink
kafka
Browse files Browse the repository at this point in the history
  • Loading branch information
storyxc committed Dec 21, 2023
1 parent 21f2a45 commit eebdeab
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion docs/java/middleware/kafka常用命令记录.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@

`kafka-topics --bootstrap-server 127.0.0.1:9092 --delete --topic topic-name`

##### 清空topic的消息

> 给topic保留消息时间改为1s,然后等topic中的消息被自动删除,再删除该配置
>
> 删除topic也可以实现清空消息
`kafka-configs --bootstrap-server 127.0.0.1:9092 --entity-type topics --alter --entity-name example --add-config retention.ms=1000`

`kafka-configs --bootstrap-server 127.0.0.1:9092 --entity-type topics --alter --entity-name example --delete-config retention.ms`

## 消费者组

##### 查看所有消费者组
Expand All @@ -44,7 +54,7 @@

##### 查看topic中的所有消息

`kafka-console-consumer --bootstrap-server 127.0.0.1:9092 --topic topic-name --from-beginning`
`kafka-console-consumer --bootstrap-server 127.0.0.1:9092 --topic topic-name --from-beginning`

##### 指定分区、offset的消息

Expand Down

0 comments on commit eebdeab

Please sign in to comment.