thomaslee
thomaslee

Reputation: 407

Why "hadoop -jar" command only launch local job?

I use "hadoop -jar" rather than "hadoop jar" by mistake when I submit a job.

In this case, my jar package cannot not be submit to the clusters, and only "local job runner" will be launched, which puzzled me so much.

Anyone knows the reason for that? Or the difference between "hadoop jar" and "hadoop -jar" command ?

Thank you!

Upvotes: 0

Views: 328

Answers (1)

SSaikia_JtheRocker
SSaikia_JtheRocker

Reputation: 5063

/usr/bin/hadoop jar is what your Hadoop's $HADOOP_HOME/bin/hadoop script requires as an argument, where $HADOOP_HOME is where you have kept your hadoop related files.

Excerpt from hadoop script

elif [ "$COMMAND" = "jar" ] ; then
  CLASS=org.apache.hadoop.util.RunJar
  HADOOP_OPTS="$HADOOP_OPTS $HADOOP_CLIENT_OPTS"

and,

elif [[ "$COMMAND" = -*  ]] ; then
  # class and package names cannot begin with a -
  echo "Error: No command named \`$COMMAND' was found. Perhaps you meant \`hadoop ${COMMAND#-}'"
  exit 1

Here COMMAND="jar" and when COMMAND=-*, or -jar it should throw an exception as coded above. I'm not sure how you can even run a local jar.

Upvotes: 2

Related Questions