hive包括lzo的本机库

huwehgph  于 2021-06-03  发布在  Hadoop
关注(0)|答案(1)|浏览(397)

我尝试在osx mountain lion上本地运行hive,并尝试遵循以下说明:
https://github.com/twitter/hadoop-lzo
我已经编译了本机osx库和jar,但是我不确定应该如何在本地启动hive,以便hive/hadoop使用本机库。
我已经尝试过通过java\u library\u 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

我还尝试在配置单元脚本中设置mapred.child.env ld\u library\u路径(运气不好):

SET mapred.child.env="LD_LIBRARY_PATH=../../scripts/jars/native/Mac_OS_X-x86_64-64";
jrcvhitl

jrcvhitl1#

再次阅读清晰的说明:
如何配置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/

相关问题