2

I have a simple shell script that I'd like to use to move log files into my Hadoop cluster.

When I invoke the the shell script in my Java program, the script can not be found "Hadoop Commands", and I do not take any action.

For instance, I would like to run the following command:

#!/bin/bash
hadoop fs -put /home/can/workspace2/myWebApp/tweets.txt /user/training/tweetFolder

How can I solve this in a simple manner?

1
  • /full/path/to/hadoop fs ... ? Good luck. Commented May 17, 2014 at 21:42

2 Answers 2

2

If you have installed Hadoop using some executables like CDH, HDP etc, it should work. But if it's a setup through Apache's tarball you need to use the complete path along with bin/, as bin directory contains all the executable files.

HADOOP_HOME/bin/hadoop fs -put /home/can/workspace2/myWebApp/tweets.txt /user/training/tweetFolder

Also, it's always a good practice to set the HADOOP_HOME variable.

Sign up to request clarification or add additional context in comments.

1 Comment

Glad that you got it working. You might wanna accept it or @Tiago's reply as the answer if you are totally satisfied, so that other can benefit from it.
1

I believe it's a PATH problem. check the path for hadoop with which:

which hadoop

Then put the full path on your script.

1 Comment

I am glad it helped. Feel free to select as correct answer :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.