Problem with -libjars in hadoop

后端 未结 3 1925
遥遥无期
遥遥无期 2020-12-01 19:07

I am trying to run MapReduce job on Hadoop but I am facing an error and I am not sure what is going wrong. I have to pas library jars which is required by my mapper.

3条回答
  •  隐瞒了意图╮
    2020-12-01 19:34

    Also worth to note subtle but important point: the way to specify additional JARs for JVMs running distributed map reduce tasks and for JVM running job client is very different.

    • -libjars makes Jars only available for JVMs running remote map and reduce task

    • To make these same JAR’s available to the client JVM (The JVM that’s created when you run the hadoop jar command) need to set HADOOP_CLASSPATH environment variable:

    $ export LIBJARS=/path/jar1,/path/jar2
    $ export HADOOP_CLASSPATH=/path/jar1:/path/jar2
    $ hadoop jar my-example.jar com.example.MyTool -libjars ${LIBJARS} -mytoolopt value
    

    See: http://grepalex.com/2013/02/25/hadoop-libjars/

    Another cause of incorrect -libjars behaviour could be in wrong implementation and initialization of custom Job class.

    • Job class must implement Tool interface
    • Configuration class instance must be obtained by calling getConf() instead of creating new instance;

    See: http://kickstarthadoop.blogspot.ca/2012/05/libjars-not-working-in-custom-mapreduce.html

提交回复
热议问题