I have been working on this problem for two days and still have not find the way.
Problem: Our Spark installed via newest CDH 5 always complains about the lost of LzoCodec class, even after I install the HADOOP_LZO through Parcels in cloudera manager. We are running MR1 on CDH 5.0.0-1.cdh5.0.0.p0.47.
Try to fix: The configurations in official CDH documentation about 'Using the LZO Parcel' are also added but the problem is still there.
Most of the googled posts give similar advices to the above. I also suspect that the spark is trying to run against YARN that is not activated there; but I can not find the configuration in CMF or other posts about this topic.
Please give me some help if you know how to deal with it.
Solved!! May the solution help others who encounter the same problem.
In this tutorial, I will show you how to enable LZO compression on Hadoop, Pig and Spark. I suppose that you have set up a basic hadoop installation successfully (if not, please refer to other tutorials for Hadoop installation ).
You reach this page possibly because you encounter the same problem as I encountered, usually starting with Java exception:
As the Apache and Cloudera distributions are two of the most popular distributions, configurations for both contexts are shown. Briefly, three main steps would be walked through towards the final success:
native-lzolibrarieshadoop-lzolibraryStep1: Installing
native-lzolibrariesThe native-lzo library is required for the installation of
hadoop-lzo. You can install them manually or by facilitating the Package Manager (NOTE: Make sure all nodes in the cluster havenative-lzoinstalled.):On Mac OS:
On RH or CentOS:
On Debian or ubuntu:
Step2: Installing
hadoop-lzolibraryFor Apache Hadoop
As the LZO is GPL'ed, it not shipped with official Hadoop distribution which takes Apache Software License. I recommend the Twitter version which is a forked version of hadoop-gpl-compression with remarkable improvements. If you are running the official Hadoop, some installation structures are provided the the documentation.
For Cloudera Distribution
In Cloudera's CDH,
hadoop-lzois shipped to customers as parcels and you can download and distribute it conviniently using the Cloudera Manager. By default, thehadoop-lzowill be installed in/opt/cloudera/parcels/HADOOP_LZO.Here we show the configuration on our cluster:
Step3: Setting up env variables
For Apache Hadoop/Pig
The basic configuration is for Apache Hadoop, while Pig is piggying upon its functionality.
Set compression codecs libraries in
core-site.xml:Set MapReduce compression configuration in
mapred-site.xml:Append
HADOOP_CLASSPATHtohadoop-env.sh:For Cloudera Distribution
You can use the Cloudera Manager to enable the same previous settings via GUI interface:
For MapReduce component, change the configuration of corresponding keys as above:
Edit MapReduce Client Environment Snippet for hadoop-env.sh to append the
HADOOP_CLASSPATHvariable.At last, restart dependent services in right order and deploy the configurations among all nodes. That's it!!. Then you can test the functionality with command and get successful messages similar to below:
For Spark
This consumes me much time because there are less information in previous posts. But the solution is strightforward with previous experience.
No matter the Spark is installed via tar or the Cloudera Manager, you need merely to append two path values to
spark-env.sh:Ralated posts and questions
A comparison of LZO performance is given in another place. A related question is also asked on StackOverflow but there are no solutions about this up to the finish of this tutorial. You maybe also interested in how to use the LZO Parcel from Cloudera.