cdh4 spark配置LZO

WBOY
WBOY원래의
2016-06-07 16:39:251139검색

使用的hadoop是cdh4.2.1版本 spark1.1,需要配置hadoop-native和lzo native 在spark-env.sh加入 HADOOP_CONF_DIR=/etc/hadoop/conf?SPARK_SUBMIT_CLASSPATH=$SPARK_SUBMIT_CLASSPATH:/etc/hive/conf:/opt/cloudera/parcels/HADOOP_LZO/lib/hadoop/lib/hadoop

使用的hadoop是cdh4.2.1版本 spark1.1,需要配置hadoop-native和lzo native

在spark-env.sh加入

HADOOP_CONF_DIR=/etc/hadoop/conf
?
SPARK_SUBMIT_CLASSPATH=$SPARK_SUBMIT_CLASSPATH:/etc/hive/conf:/opt/cloudera/parcels/HADOOP_LZO/lib/hadoop/lib/hadoop-lzo.jar
#SPARK_SUBMIT_LIBRARY_PATH=$SPARK_SUBMIT_LIBRARY_PATH:/opt/cloudera/parcels/CDH/lib/hadoop/lib/native:/opt/cloudera/parcels/HADOOP_LZO/lib/hadoop/lib/native
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/cloudera/parcels/CDH/lib/hadoop/lib/native:/opt/cloudera/parcels/HADOOP_LZO/lib/hadoop/lib/native

我加了SPARK_SUBMIT_LIBRARY_PATH发现是加入了java.library.path,但是丢了默认的配置。改为加入LD_LIBRARY_PATH里

spark-defaults.conf的配置

spark.ui.port   8810
spark.executor.extraLibraryPath /opt/cloudera/parcels/CDH/lib/hadoop/lib/native:/opt/cloudera/parcels/HADOOP_LZO/lib/hadoop/lib/native

可能还需要加上 spark.executor.extraClassPath,但我当前还是单机测试,没配也能跑成功。。
启动spark-sql试试,打开监控页面看看 http://xxxx:8810/environment/ 是否配置正确。

参考:
http://hsiamin.com/posts/2014/05/03/enable-lzo-compression-on-hadoop-pig-and-spark/ (按这里的配置不成功,可能环境变量名称改了。)

http://lotso.blog.51cto.com/3681673/1441737

https://spark.apache.org/docs/latest/configuration.html

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.