2

I'm currently using hadoop mapreduce jobs with SequenceFiles of writables. The same Writable type are used for serialization also in the non-hadoop related parts of the system.

This method is hard to maintain - mainly because of the lack of schema and the need for manual handling of version changes.

It appears that apache avro handles these issues.

The problem is, that during the migration I will have data in both formats. is there a simple way to handle the migration?

4

2 回答 2

2

我自己没有尝试过,但也许使用AvroSequenceFile格式会有所帮助。它只是一个包装器,SequenceFile因此理论上您应该能够以旧SequenceFile格式和新Avro格式写入数据,这应该使迁移更容易。

这是有关此格式的更多信息。

于 2013-11-18T03:45:59.327 回答
1

通常,没有什么可以阻止您互换使用 Avro 数据和 SequenceFiles。使用所需的数据类型所需的任何 InputFormat,对于输出,在实际情况下使用 Avro 格式当然是有意义的。如果您的输入有不同的格式,请查看MultipleInputs。本质上,您仍然必须实现单独的 Mappers,但考虑到 Map 输入键/值不同,这是可以预料的。

搬到 Avro 是明智之举。如果您有足够的时间和硬件能力,甚至可能值得立即将您的数据从 SequenceFile 显式转换为 Avro。您可以使用 Avro 支持的任何语言,它也恰好支持 SequenceFiles 来执行此操作。Java 肯定会(很明显),但 Pig 也非常方便地执行此操作。

用户贡献的 PiggyBank 项目具有读取 SequenceFile 的功能,然后只需使用来自同一个 PiggyBank 项目的 AvroStorage 和适当的 Avro 方案来获取您的 Avro 文件。

如果只有 Pig 支持从文件加载 Avro 模式.. !如果您使用 Pig,您将不得不编写显式包含 Avro 模式的脚本,这可能有点烦人。

于 2013-11-20T08:02:38.350 回答