Question

I've setup a Hadoop cluster using the newly 2.x version. And I installed snappy and hadoop snappy according to this guide, to enable snappy compression in map output.

When running the example wordcount, The error occurred:

[dm@node1 ~]$ hadoop jar /opt/hadoop-2.0.5-alpha/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.0.5-alpha.jar wordcount /in /out
13/09/06 05:09:52 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
13/09/06 05:09:53 INFO service.AbstractService: Service:org.apache.hadoop.yarn.client.YarnClientImpl is inited.
13/09/06 05:09:53 INFO service.AbstractService: Service:org.apache.hadoop.yarn.client.YarnClientImpl is started.
13/09/06 05:10:04 INFO input.FileInputFormat: Total input paths to process : 1
13/09/06 05:10:04 INFO snappy.LoadSnappy: Snappy native library loaded
13/09/06 05:10:04 INFO lzo.GPLNativeCodeLoader: Loaded native gpl library
13/09/06 05:10:04 INFO lzo.LzoCodec: Successfully loaded & initialized native-lzo library [hadoop-lzo rev d0f5a10f99f1b2af4f6610447052c5a67b8b1cc7]
13/09/06 05:10:04 INFO mapreduce.JobSubmitter: number of splits:1
13/09/06 05:10:04 WARN conf.Configuration: mapred.jar is deprecated. Instead, use mapreduce.job.jar
13/09/06 05:10:04 WARN conf.Configuration: mapred.output.value.class is deprecated. Instead, use mapreduce.job.output.value.class
13/09/06 05:10:04 WARN conf.Configuration: mapreduce.combine.class is deprecated. Instead, use mapreduce.job.combine.class
13/09/06 05:10:04 WARN conf.Configuration: mapreduce.map.class is deprecated. Instead, use mapreduce.job.map.class
13/09/06 05:10:04 WARN conf.Configuration: mapred.job.name is deprecated. Instead, use mapreduce.job.name
13/09/06 05:10:04 WARN conf.Configuration: mapreduce.reduce.class is deprecated. Instead, use mapreduce.job.reduce.class
13/09/06 05:10:04 WARN conf.Configuration: mapred.input.dir is deprecated. Instead, use mapreduce.input.fileinputformat.inputdir
13/09/06 05:10:04 WARN conf.Configuration: mapred.output.dir is deprecated. Instead, use mapreduce.output.fileoutputformat.outputdir
13/09/06 05:10:04 WARN conf.Configuration: mapred.map.tasks is deprecated. Instead, use mapreduce.job.maps
13/09/06 05:10:04 WARN conf.Configuration: mapred.output.key.class is deprecated. Instead, use mapreduce.job.output.key.class
13/09/06 05:10:04 WARN conf.Configuration: mapred.working.dir is deprecated. Instead, use mapreduce.job.working.dir
13/09/06 05:10:05 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_1378415309099_0001
13/09/06 05:10:06 INFO client.YarnClientImpl: Submitted application application_1378415309099_0001 to ResourceManager at node1/192.168.56.101:60832
13/09/06 05:10:06 INFO mapreduce.Job: The url to track the job: http://node1:60888/proxy/application_1378415309099_0001/
13/09/06 05:10:06 INFO mapreduce.Job: Running job: job_1378415309099_0001
13/09/06 05:10:32 INFO mapreduce.Job: Job job_1378415309099_0001 running in uber mode : false
13/09/06 05:10:32 INFO mapreduce.Job:  map 0% reduce 0%
13/09/06 05:10:53 INFO mapreduce.Job:  map 100% reduce 0%
13/09/06 05:11:02 INFO mapreduce.Job: Task Id : attempt_1378415309099_0001_m_000000_0, Status : FAILED
Error: org.apache.hadoop.util.NativeCodeLoader.buildSupportsSnappy()Z
Container killed by the ApplicationMaster.


13/09/06 05:11:03 INFO mapreduce.Job:  map 0% reduce 0%
13/09/06 05:11:07 INFO mapreduce.Job: Task Id : attempt_1378415309099_0001_m_000000_1, Status : FAILED
Error: org.apache.hadoop.util.NativeCodeLoader.buildSupportsSnappy()Z
13/09/06 05:11:13 INFO mapreduce.Job: Task Id : attempt_1378415309099_0001_m_000000_2, Status : FAILED
Error: org.apache.hadoop.util.NativeCodeLoader.buildSupportsSnappy()Z
13/09/06 05:11:19 INFO mapreduce.Job:  map 100% reduce 0%
13/09/06 05:11:19 INFO mapreduce.Job: Job job_1378415309099_0001 failed with state FAILED due to: Task failed task_1378415309099_0001_m_000000
Job failed as tasks failed. failedMaps:1 failedReduces:0

13/09/06 05:11:19 INFO mapreduce.Job: Counters: 6
    Job Counters 
        Failed map tasks=4
        Launched map tasks=4
        Other local map tasks=3
        Data-local map tasks=1
        Total time spent by all maps in occupied slots (ms)=42989
        Total time spent by all reduces in occupied slots (ms)=0

I searched google about the error message "Error: org.apache.hadoop.util.NativeCodeLoader.buildSupportsSnappy()Z", haven't find the solution to this problem. So I want to know how can I enable snappy compression in Hadoop 2.x? Thanks.

Was it helpful?

Solution

good server:

$ hadoop checknative -a | grep snappy
15/06/18 14:51:05 INFO bzip2.Bzip2Factory: Successfully loaded & initialized native-bzip2 library system-native
15/06/18 14:51:05 INFO zlib.ZlibFactory: Successfully loaded & initialized native-zlib library
snappy:  true /opt/cloudera/parcels/CDH-5.4.2-1.cdh5.4.2.p0.2/lib/hadoop/lib/native/libsnappy.so.1

not good server:

$ hadoop checknative -a | grep snappy
15/06/18 14:50:31 INFO bzip2.Bzip2Factory: Successfully loaded & initialized native-bzip2 library system-native
15/06/18 14:50:31 INFO zlib.ZlibFactory: Successfully loaded & initialized native-zlib library
snappy:  true /usr/lib64/libsnappy.so.1

Notice in one case "hadoop checknative" command returns system's libsnappy, in another case - one from a Hadoop distrubution. If you have hadoop on some hosts report that they use system's libsnappy, errors like ".hadoop.mapred.YarnChild: Error running child : java.lang.UnsatisfiedLinkError: org.apache.hadoop.util.NativeCodeLoader.buildSupportsSnappy()Z at org.apache.hadoop.util.NativeCodeLoader.buildSupportsSnappy(Native Method) " are quite possible.

OTHER TIPS

From the output you’ve presented ( WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... etc.. ) it looks like your native library isn't loading. I think it would be worth trying to build and install the native library and then adding the Snappy library inside it at <HADOOP_HOME>/lib/native/ . I think that might resolve the issue. Hope that helps!

It looks like your code is not able to load snappy native library.There could be two possible explanation for this. Either you are using a version of snappy which is not compatible with the version of hadoop you have installed. OR You have not added the library in your classpath.

The second parameter on that guide is wrong.

Use mapreduce.map.output.compress.codec instead.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top