2015-05-08 86 views

回答

1

.jhist文件中的第二行是文件中其他jsons的avro模式。这意味着您可以从jhist文件中创建avro数据。 为此,您可以使用avro-tools-1.7.7.jar

# schema is the second line 
sed -n '2p;3q' file.jhist > schema.avsc 

# removing the first two lines 
sed '1,2d' file.jhist > pfile.jhist 

# finally converting to avro data 
java -jar avro-tools-1.7.7.jar fromjson pfile.jhist --schema-file schema.avsc > file.avro 

你有一个Avro的数据,这些数据例如,你可以导入到蜂巢表,并在其上查询。

+0

这可以用来解析avro二进制文件吗?我尝试解析.jhist文件,它是avro二进制格式,并在尝试转换时,遇到一些二进制字符时会抛出错误。 – CodingOwl

0

您可以检出Rumen,apache生态系统的解析工具 或者当您访问Web UI时,转到作业历史记录并查找要读取.jhist文件的作业。点击左侧的计数器链接,现在您将能够看到一个API,它提供了所有参数和值,例如以毫秒为单位的CPU时间等,它将从.jhist文件本身读取。