0
点赞
收藏
分享

微信扫一扫

Offline Edits Viewer Guide


Offline Edits Viewer Guide

Overview

离线的Edits查看器是一个解析Editslog文件的工具。当前程序需要用于不同格式的转换,包括人类可读的和比本地二进制格式更易编辑XML文件。

此工具可以解析Hadoop0.18和机器之后版本的edits格式。这个工具只操作文件,不需要Hadoop集群正在运行。

数据格式支持:

1.      Binary:Hadoop内部使用的本地二进制格式

2.      Xml:XML格式,xml处理器生成的,如果文件名有.xml后缀(大小写敏感)

离线的Edits查看器提供几个输出处理器(除了明确描述的,处理器的输出可被转换回原始edits文件):

1.      Binary:Hadoop内部使用的本地二进制格式

2.      Xml:XML格式

3.      Stats:打印统计数据,这个不能被转换回Edits文件

Usage

bash$ bin/hdfs oev -iedits -o edits.xml

Flag

Description

[-i ; --inputFile]input file

Specify the input edits log file to process. Xml (case insensitive) extension means XML format otherwise binary format is assumed. Required.

[-o ; --outputFile]output file

Specify the output filename, if the specified output processor generates one. If the specified file already exists, it is silently overwritten. Required.

[-p ; --processor]processor

Specify the image processor to apply against the image file. Currently valid options are binary, xml (default) and stats.

[-v ; --verbose]

Print the input and output filenames and pipe output of processor to console as well as specified file. On extremely large files, this may increase processing time by an order of magnitude.

[-h ; --help]

Display the tool usage and help information and exit.

Case study:Hadoop clusterrecovery

在这个案例中,Hadoop集群出现了一些问题,edits文件损坏了,但是保存一个文件的正确部分是可能的。这可以通过转换binary edit文件到XML格式,手工编辑XML格式文件,然后再将其转换为binary。常见的问题是edit文件丢失结束记录(结束记录的opCode=-1)。这应该通过此工具组织,然后正确地在XML格式的文件中关闭。

如果XML文件中没有结束记录,你可以在最后一个正确的记录上增加一个。任何opCode=-1的记录将被忽略。

结束记录的一个例子(opCode=-1):



<RECORD> <OPCODE>-1</OPCODE> <DATA> </DATA> </RECORD>

举报

相关推荐

0 条评论