kafka创建topic的命令
时间: 2023-10-08 19:11:19 浏览: 151
Kafka常用命令收录
Kafka创建topic的命令通常使用kafka-topics.sh脚本来完成。一个常用的创建topic的命令如下所示:
```shell
kafka-topics.sh --create --topic test --partitions 3 --replication-factor 3 --bootstrap-server localhost:9092
```
这条命令会创建一个名为test的topic,设置3个分区,每个分区需分配3个副本。在执行这条命令之后,Kafka会返回"Created topic 'test'"的消息,表示topic创建成功。需要注意的是,这只是创建topic的第一步,后续还有其他步骤要完成,包括controller的工作等。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [kafka是如何创建topic的](https://blog.csdn.net/Maxiao1204/article/details/120753126)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* [kafka使用命令.txt](https://download.csdn.net/download/weixin_35085215/12504208)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文