這篇文章給大家介紹spark中怎么配置啟用LZO壓縮,內(nèi)容非常詳細(xì),感興趣的小伙伴們可以參考借鑒,希望對(duì)大家能有所幫助。
創(chuàng)新互聯(lián)成立于2013年,我們提供高端重慶網(wǎng)站建設(shè)公司、網(wǎng)站制作、網(wǎng)站設(shè)計(jì)、網(wǎng)站定制、成都全網(wǎng)營銷推廣、微信小程序、微信公眾號(hào)開發(fā)、成都網(wǎng)站推廣服務(wù),提供專業(yè)營銷思路、內(nèi)容策劃、視覺設(shè)計(jì)、程序開發(fā)來完成項(xiàng)目落地,為社區(qū)文化墻企業(yè)提供源源不斷的流量和訂單咨詢。
Spark中配置啟用LZO壓縮,步驟如下:
一、spark-env.sh配置
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/app/hadoop-2.6.0-cdh6.7.0/lib/native
export SPARK_LIBRARY_PATH=$SPARK_LIBRARY_PATH:/app/hadoop-2.6.0-cdh6.7.0/lib/native
export SPARK_CLASSPATH=$SPARK_CLASSPATH:/app/hadoop-2.6.0-cdh6.7.0/share/hadoop/yarn/*:/app/hadoop-2.6.0-cdh6.7.0/share/hadoop/yarn/lib/*:/app/hadoop-2.6.0-cdh6.7.0/share/hadoop/common/*:/app/hadoop-2.6.0-cdh6.7.0/share/hadoop/common/lib/*:/app/hadoop-2.6.0-cdh6.7.0/share/hadoop/hdfs/*:/app/hadoop-2.6.0-cdh6.7.0/share/hadoop/hdfs/lib/*:/app/hadoop-2.6.0-cdh6.7.0/share/hadoop/mapreduce/*:/app/hadoop-2.6.0-cdh6.7.0/share/hadoop/mapreduce/lib/*:/app/hadoop-2.6.0-cdh6.7.0/share/hadoop/tools/lib/*:/app/spark-2.2.0-bin-2.6.0-cdh6.7.0/jars/*
2、無法找到LzopCodec類
2.1、錯(cuò)誤提示:
Caused by: java.lang.IllegalArgumentException: Compression codec com.hadoop.compression.lzo.LzopCodec not found.
at org.apache.hadoop.io.compress.CompressionCodecFactory.getCodecClasses(CompressionCodecFactory.java:135)
at org.apache.hadoop.io.compress.CompressionCodecFactory.
at org.apache.hadoop.mapred.TextInputFormat.configure(TextInputFormat.java:45)
Caused by: java.lang.ClassNotFoundException: Class com.hadoop.compression.lzo.LzopCodec not found
at org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:1980)
at org.apache.hadoop.io.compress.CompressionCodecFactory.getCodecClasses(CompressionCodecFactory.java:128)
2.2、解決辦法:在spark的conf中配置spark-defaults.conf,增加以下內(nèi)容:
spark.driver.extraClassPath /app/hadoop-2.6.0-cdh6.7.0/share/hadoop/common/hadoop-lzo-0.4.19.jar
spark.executor.extraClassPath /app/hadoop-2.6.0-cdh6.7.0/share/hadoop/common/hadoop-lzo-0.4.19.jar
關(guān)于spark中怎么配置啟用LZO壓縮就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,可以學(xué)到更多知識(shí)。如果覺得文章不錯(cuò),可以把它分享出去讓更多的人看到。