Suppose I write a java program and i want to run it in Hadoop, then
hadoop classname
The simplest answers I can think of to your questions are:
1) Anywhere
2,3,4) $HADOOP_HOME/bin/hadoop jar [path_to_your_jar_file]
A similar question was asked here Executing helloworld.java in apache hadoop
It may seem complicated, but it's simpler than you might think!
map/reduce
classes, and your main
class into a jar. Let's call this jar myjob.jar
.
hadoop
command line utility installed. hadoop jar myjob.jar
Hope that helps.
The data should be saved in "hdfs". You will want to probably load it into the cluster from your data source using something like Apache Flume. The file can be placed anywhere but most home is /user/hadoop/
SSH into the hadoop cluster headnode like a standard linux server.
To list your hadoop root hdfs hadoop fs -ls /
hadoop classname
You should be using the hadoop command to access your data and run your programs, try hadoop help
hadoop -jar MyJar.jar com.mycompany.MainDriver arg[0] arg[1] ...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.