我正试图在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运行配置单元时,例如:
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";
答案 0 :(得分:1)
再次阅读明确的指示:
如何配置Hadoop以使用这些类?
# Copy the native library
tar -cBf - -C build/hadoop-gpl-compression-0.1.0-dev/lib/native . | tar -xBvf - -C /path/to/hadoop/dist/lib/native
基本上我只需要将构建的本机库复制到我的hadoop安装中:
ant compile-native tar
cp -r build/hadoop-lzo-0.4.17-SNAPSHOT/lib/native/Mac_OS_X-x86_64-64 /usr/local/Cellar/hadoop/1.1.2/libexec/lib/native/