赞
踩
服务器名称 | 服务器ip |
---|---|
centos7虚拟机1 | 192.168.136.27 |
centos7虚拟机2 | 192.168.136.28 |
centos7虚拟机3 | 192.168.136.29 |
查看topic命令参数
[root@localhost kafka-3.0.0]# bin/kafka-topics.sh
参数 | 描述 |
---|---|
–bootstrap-server <String: server toconnect to> | 连接的 Kafka Broker主机名称和端口号。 |
–topic <String: topic> | 操作的 topic名称。 |
–create | 创建主题。 |
–delete | 删除主题。 |
–alter | 修改主题。 |
–list | 看所有主题。 |
–describe | 查看主题详细描述。 |
–partitions <Integer: # of partitions> | 设置分区数。 |
–replication-factor<Integer: replication factor> | 设置分区副本。 |
–config <String: name=value> | 更新系统默认的配置。 |
查看centos7虚拟机2 (192.168.136.28)服务器中的所有 topic
[root@localhost kafka-3.0.0]# bin/kafka-topics.sh --bootstrap-server 192.168.136.28:9092 --list
创建 一个新闻(news) topic
[root@localhost kafka-3.0.0]# bin/kafka-topics.sh --bootstrap-server 192.168.136.28:9092 --create --partitions 1 --replication-factor 3 --topic news
选项说明
选项 | 选项说明 |
---|---|
–topic | 定义 topic 名 |
–replication-factor | 定义副本数 |
–partitions | 定义分区数 |
查看新闻(news)topic的详情
[root@localhost kafka-3.0.0]# bin/kafka-topics.sh --bootstrap-server 192.168.136.28:9092 --describe --topic news
修改新闻(news)topic的分区数
[root@localhost kafka-3.0.0]# bin/kafka-topics.sh --bootstrap-server 192.168.136.28:9092 --alter --partitions 3 --topic news
再次新闻(news)topic的详情
[root@localhost kafka-3.0.0]# bin/kafka-topics.sh --bootstrap-server 192.168.136.28:9092 --describe --topic news
删除 新闻(news)topic
[root@localhost kafka-3.0.0]# bin/kafka-topics.sh --bootstrap-server 192.168.136.28:9092 --delete --topic news
再次查看新闻(news)topic的详情
[root@localhost kafka-3.0.0]# bin/kafka-topics.sh --bootstrap-server 192.168.136.28:9092 --describe --topic news
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。