我正在尝试在 OSX Mountain Lion 上本地运行 Hive,并尝试按照此处的说明进行操作:
https://github.com/twitter/hadoop-lzo
我已经编译了本机 OSX 库和 jar,但我不确定我应该如何在本地启动 Hive,以便 Hive/Hadoop 使用本机库。
我已经尝试通过 JAVA_LIBRARY_PATH 环境变量包含它,但我认为这通常只适用于 Hadoop。
export JAVA_LIBRARY_PATH="${SCRIPTS_DIR}/jars/native/Mac_OS_X-x86_64-64"
当我使用 LzopCodec 运行 hive 时,例如:
SET mapred.output.compression.codec = com.hadoop.compression.lzo.LzopCodec;
运行运行 map/reduce 作业的查询时出现以下错误:
SELECT COUNT(*) from test_table;
Job running in-process (local Hadoop)
org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeException: native-lzo library not available
at org.apache.hadoop.hive.ql.io.HiveFileFormatUtils.getHiveRecordWriter(HiveFileFormatUtils.java:237)
at org.apache.hadoop.hive.ql.exec.FileSinkOperator.createBucketFiles(FileSinkOperator.java:477)
at org.apache.hadoop.hive.ql.exec.FileSinkOperator.processOp(FileSinkOperator.java:525)
at org.apache.hadoop.hive.ql.exec.Operator.process(Operator.java:471)
at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:762)
at org.apache.hadoop.hive.ql.exec.SelectOperator.processOp(SelectOperator.java:84)
at org.apache.hadoop.hive.ql.exec.Operator.process(Operator.java:471)
at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:762)
at org.apache.hadoop.hive.ql.exec.GroupByOperator.forward(GroupByOperator.java:959)
at org.apache.hadoop.hive.ql.exec.GroupByOperator.closeOp(GroupByOperator.java:995)
at org.apache.hadoop.hive.ql.exec.Operator.close(Operator.java:557)
at org.apache.hadoop.hive.ql.exec.ExecReducer.close(ExecReducer.java:303)
at org.apache.hadoop.mapred.ReduceTask.runOldReducer(ReduceTask.java:530)
at org.apache.hadoop.mapred.ReduceTask.run(ReduceTask.java:421)
at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:262)
Caused by: java.lang.RuntimeException: native-lzo library not available
at com.hadoop.compression.lzo.LzoCodec.getCompressorType(LzoCodec.java:155)
at org.apache.hadoop.io.compress.CodecPool.getCompressor(CodecPool.java:100)
at com.hadoop.compression.lzo.LzopCodec.getCompressor(LzopCodec.java:135)
at com.hadoop.compression.lzo.LzopCodec.createOutputStream(LzopCodec.java:70)
at org.apache.hadoop.hive.ql.exec.Utilities.createCompressedStream(Utilities.java:868)
at org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat.getHiveRecordWriter(HiveIgnoreKeyTextOutputFormat.java:80)
at org.apache.hadoop.hive.ql.io.HiveFileFormatUtils.getRecordWriter(HiveFileFormatUtils.java:246)
at org.apache.hadoop.hive.ql.io.HiveFileFormatUtils.getHiveRecordWriter(HiveFileFormatUtils.java:234)
... 14 more
我还尝试在 Hive 脚本中设置 mapred.child.env LD_LIBRARY_PATH(不走运):
SET mapred.child.env="LD_LIBRARY_PATH=../../scripts/jars/native/Mac_OS_X-x86_64-64";