Kafka学习之Replication tools之StateChangeLogMerger Tool

原文链接:https://cwiki.apache.org/confluence/display/KAFKA/Replication+tools#Replicationtools-7.StateChangeLogMergerTool
此工具能做啥 ?

 

此工具的目标是从集群中的各个broker中收集数据并格式化最后合并成一个文件来帮助我们查看state changes,查明问题。集群中的每一个broker会打日志到一个state-change.log文件,记录了broker接收的每一个state change的生命周期。有时候,选举一个leader会出现一些问题,为了回答这些问题,我们需要一个全局的state change的视图,可能会做一个时间范围and/or topic/partitions的过滤,这就是本工具的作用。它接收一个state-changes.log文件的列表为参数,按照时间顺序合并它们,如果指定了时间范围则按照这个范围进行过滤,如果指定了topics/partitions则又进行一次过滤,然后输出一个合并的并格式化的state-change.log文件,这可以简化定位问题,并理解其中的来龙去脉。

如何使用?

nnarkhed-mn:kafka-git-idea nnarkhed$ ./bin/kafka-run-class.sh kafka.tools.StateChangeLogMerger
Provide arguments to exactly one of the two options "[logs]" or "[logs-regex]"
Option                                  Description
------                                  -----------
--end-time <end timestamp in the        The latest timestamp of state change
  format java.text.                       log entries to be merged (default:
  SimpleDateFormat@f17a63e7>              9999-12-31 23:59:59,999)
--logs <file1,file2,...>                Comma separated list of state change
                                          logs or a regex for the log file
                                          names
--logs-regex <for example: /tmp/state-  Regex to match the state change log
  change.log*>                            files to be merged
--partitions <0,1,2,...>                Comma separated list of partition ids
                                          whose state change logs should be
                                          merged
--start-time <start timestamp in the    The earliest timestamp of state change
  format java.text.                       log entries to be merged (default:
  SimpleDateFormat@f17a63e7>              0000-00-00 00:00:00,000)
--topic <topic>                         The topic whose state change logs
                                          should be merged

猜你喜欢

转载自damacheng009.iteye.com/blog/2088621