kafka消息队列运维工具和相关安装目录文件总结
2017-05-08 18:33
666 查看
kafka自带维护脚本工具总结:
topic管理脚本:kafka-topics.sh(包括topic的创建,修改,删除,查询)
创建topic: sh kafka-topics.sh –zookeeper localip:2181 –create –topictest1 –partitions 4 --replication-factor 2
列出所有topic: sh kafka-topics.sh –zookeeper localip:2181 –list
显示某个topic的详细信息(包括partitions,leader partition,isr等):shkafka-topics.sh --zookeeper localip:2181 --describe --topic billtest
终止脚本:kafka-server-stop.sh
目前该脚本有问题,用netstat -anp|grep 端口号然后kill掉
启动脚本:kafka-server-start.sh
用法nohup sh kafka-server-start.sh ../config/server.properties &
自带的生产脚本:kafka-console-producer.sh
用法:sh kafka-console-producer.sh --broker-list xxxx,xxxxx,xxxxx --topic billtest
自带的消费脚本:用法:kafka-console-consumer.sh
sh kafka-console-consumer.sh--bootstrap-server xxxx,xxxxx,xxxxx --topic billtest
手工平衡(rebalance)脚本:kafka-preferred-replica-election.sh
用法:sh kafka-preferred-replica-election.sh --zookeeper localhost:2181
检查偏移量状态脚本:kafka-consumer-offset-checker.sh
用法 : sh kafka-consumer-offset-checker.sh --zookeeper localhost:2181 --group test --topicbilltest3 --broker-info (--broker-info显示broker_id和ip:端口的关联)
管理消费组的脚本:kafka-consumer-groups.sh(可以描述和删除消费者组)
用法:sh kafka-consumer-groups.sh --bootstrap-server xxxx,xxxx,xxxx --describe --group mytest
分区管理脚本:kafka-reassign-partitions.sh(该脚本是管理数据迁移,分布的重要工具)
用法:
1.产生候选作业:shkafka-reassign-partitions.sh --zookeeper localhost:2181 --topics-to-move-json-filetopics-to-move.json --broker-list "5,6" –generate(只是产生分配方案,还未执行)
> cattopics-to-move.json
{"topics": [{"topic":"foo1"},
{"topic":"foo2"}],
"version":1
}
2.执行分配作业:sh kafka-reassign-partitions.sh--zookeeper localhost:2181 --reassignment-json-fileexpand-cluster-reassignment.json –execute
--其实可以直接写分配作业json文件以供执行,json文件的格式也是很容易发现格式规范,expand-cluster-reassignment.json如下
{"version":1,
"partitions":[{"topic":"foo1","partition":2,"replicas":[5,6]},
{"topic":"foo1","partition":0,"replicas":[5,6]},
{"topic":"foo2","partition":2,"replicas":[5,6]},
{"topic":"foo2","partition":0,"replicas":[5,6]},
{"topic":"foo1","partition":1,"replicas":[5,6]},
{"topic":"foo2","partition":1,"replicas":[5,6]}]
}
--除了固定的”version":1和"partitions":外,里面的内容是最终要生成的分配方案,哪个topic的某个partition的副本replicas要分布到哪些节点上。
3.检查作业执行情况:kafka-reassign-partitions.sh--zookeeper localhost:2181 --reassignment-json-fileexpand-cluster-reassignment.json –verify
4.控制数据重分布的速度:kafka-reassign-partitions.sh--zookeeper myhost:2181--execute --reassignment-json-file bigger-cluster.json—throttle 50000000
为主题,客户端,用户或代理添加/删除实体配置的脚本:kafka-configs.sh
用法:in/kafka-configs.sh --zookeeperlocalhost:2181 --alter --add-config'producer_byte_rate=1024,consumer_byte_rate=2048' --entity-type clients--entity-default
安装目录和文件说明:
Data目录下的文件和子目录:
· cleaner-offset-checkpoint:存了每个log的最后清理offset
· meta.properties: broker.id 信息
· recovery-point-offset-checkpoint:表示已经刷写到磁盘的记录。recoveryPoint以下的数据都是已经刷到磁盘上的了。
· replication-offset-checkpoint: 用来存储每个replica的HighWatermark的(high watermark (HW),表示已经被commited的message,HW以下的数据都是各个replicas间同步的,一致的。)
子目录:类似__consumer_offsets-16(其中__consumer_offsets是topic名,16是partitions号)
子目录里面包含三类文件:
-rw-rw-r-- 1 itzxyy itzxyy 10485756 May 5 16:48 00000000000000000000.timeindex
-rw-rw-r-- 1 itzxyy itzxyy 10485760 May 5 16:48 00000000000000000000.index
-rw-rw-r-- 1 itzxyy itzxyy 303547066May 5 16:50 00000000000000000000.log
Timeindex是时间戳+偏移量组成的索引文件
Index是消息偏移量+物理偏移量组成的索引文件
Log是消息元信息和具体数据保存文件
Config目录下的文件:
server.properties 服务端的配置文件
producer.properties 可能是供自带生产脚本使用
consumer.properties可能是供自带消费脚本使用
topic管理脚本:kafka-topics.sh(包括topic的创建,修改,删除,查询)
创建topic: sh kafka-topics.sh –zookeeper localip:2181 –create –topictest1 –partitions 4 --replication-factor 2
列出所有topic: sh kafka-topics.sh –zookeeper localip:2181 –list
显示某个topic的详细信息(包括partitions,leader partition,isr等):shkafka-topics.sh --zookeeper localip:2181 --describe --topic billtest
终止脚本:kafka-server-stop.sh
目前该脚本有问题,用netstat -anp|grep 端口号然后kill掉
启动脚本:kafka-server-start.sh
用法nohup sh kafka-server-start.sh ../config/server.properties &
自带的生产脚本:kafka-console-producer.sh
用法:sh kafka-console-producer.sh --broker-list xxxx,xxxxx,xxxxx --topic billtest
自带的消费脚本:用法:kafka-console-consumer.sh
sh kafka-console-consumer.sh--bootstrap-server xxxx,xxxxx,xxxxx --topic billtest
手工平衡(rebalance)脚本:kafka-preferred-replica-election.sh
用法:sh kafka-preferred-replica-election.sh --zookeeper localhost:2181
检查偏移量状态脚本:kafka-consumer-offset-checker.sh
用法 : sh kafka-consumer-offset-checker.sh --zookeeper localhost:2181 --group test --topicbilltest3 --broker-info (--broker-info显示broker_id和ip:端口的关联)
管理消费组的脚本:kafka-consumer-groups.sh(可以描述和删除消费者组)
用法:sh kafka-consumer-groups.sh --bootstrap-server xxxx,xxxx,xxxx --describe --group mytest
分区管理脚本:kafka-reassign-partitions.sh(该脚本是管理数据迁移,分布的重要工具)
用法:
1.产生候选作业:shkafka-reassign-partitions.sh --zookeeper localhost:2181 --topics-to-move-json-filetopics-to-move.json --broker-list "5,6" –generate(只是产生分配方案,还未执行)
> cattopics-to-move.json
{"topics": [{"topic":"foo1"},
{"topic":"foo2"}],
"version":1
}
2.执行分配作业:sh kafka-reassign-partitions.sh--zookeeper localhost:2181 --reassignment-json-fileexpand-cluster-reassignment.json –execute
--其实可以直接写分配作业json文件以供执行,json文件的格式也是很容易发现格式规范,expand-cluster-reassignment.json如下
{"version":1,
"partitions":[{"topic":"foo1","partition":2,"replicas":[5,6]},
{"topic":"foo1","partition":0,"replicas":[5,6]},
{"topic":"foo2","partition":2,"replicas":[5,6]},
{"topic":"foo2","partition":0,"replicas":[5,6]},
{"topic":"foo1","partition":1,"replicas":[5,6]},
{"topic":"foo2","partition":1,"replicas":[5,6]}]
}
--除了固定的”version":1和"partitions":外,里面的内容是最终要生成的分配方案,哪个topic的某个partition的副本replicas要分布到哪些节点上。
3.检查作业执行情况:kafka-reassign-partitions.sh--zookeeper localhost:2181 --reassignment-json-fileexpand-cluster-reassignment.json –verify
4.控制数据重分布的速度:kafka-reassign-partitions.sh--zookeeper myhost:2181--execute --reassignment-json-file bigger-cluster.json—throttle 50000000
为主题,客户端,用户或代理添加/删除实体配置的脚本:kafka-configs.sh
用法:in/kafka-configs.sh --zookeeperlocalhost:2181 --alter --add-config'producer_byte_rate=1024,consumer_byte_rate=2048' --entity-type clients--entity-default
安装目录和文件说明:
Data目录下的文件和子目录:
· cleaner-offset-checkpoint:存了每个log的最后清理offset
· meta.properties: broker.id 信息
· recovery-point-offset-checkpoint:表示已经刷写到磁盘的记录。recoveryPoint以下的数据都是已经刷到磁盘上的了。
· replication-offset-checkpoint: 用来存储每个replica的HighWatermark的(high watermark (HW),表示已经被commited的message,HW以下的数据都是各个replicas间同步的,一致的。)
子目录:类似__consumer_offsets-16(其中__consumer_offsets是topic名,16是partitions号)
子目录里面包含三类文件:
-rw-rw-r-- 1 itzxyy itzxyy 10485756 May 5 16:48 00000000000000000000.timeindex
-rw-rw-r-- 1 itzxyy itzxyy 10485760 May 5 16:48 00000000000000000000.index
-rw-rw-r-- 1 itzxyy itzxyy 303547066May 5 16:50 00000000000000000000.log
Timeindex是时间戳+偏移量组成的索引文件
Index是消息偏移量+物理偏移量组成的索引文件
Log是消息元信息和具体数据保存文件
Config目录下的文件:
server.properties 服务端的配置文件
producer.properties 可能是供自带生产脚本使用
consumer.properties可能是供自带消费脚本使用
相关文章推荐
- 安装交叉编译工具,执行arm-linux-gcc –v命令出现提示找不到该文件或目录?解决方法
- 分布式消息队列Kafka集群安装
- 消息队列相关函数总结
- 分布式消息队列kafka系列介绍 — 配置文件详解
- 【总结】Hadoop NameNode元数据相关文件目录解析
- 安装交叉编译工具,执行arm-linux-gcc –v命令出现提示找不到该文件或目录?解决方法
- 对指定文件或目录进行压缩和解压缩的工具类总结
- 安装交叉编译工具,执行arm-linux-gcc–v命令出现提示找不到该文件或目录?解决方法
- chmod +x *.sh 这个命令是为sh文件增加可执行权限; chmod +R 777 *.* 对当前目录下的所有子目录和子文件进行 777权限的变更;通在安装软件时复制相关文件。
- 分布式消息队列Kafka集群安装
- 安装交叉编译工具出错,arm-linux-gcc: 没有那个文件或目录
- 分布式消息队列Kafka集群安装
- 分布式消息队列Kafka集群安装
- 安装交叉编译工具,执行arm-linux-gcc –v命令出现提示找不到该文件或目录?解决方法(转)
- kafka分布式消息队列----安装篇
- 安装交叉编译工具,执行arm-linux-gcc –v命令出现提示找不到该文件或目录?解决方法
- CentOS 7.0 安装配置 kafka 消息队列
- Kafka消息队列原理总结
- RabbitMQ(消息队列)Linux安装相关问题解决
- 分布式消息队列kafka系列介绍 — 配置文件详解