How do I run a Java program in a single node cluster in hadoop? Do I need to convert my java code into a JAR file and then execute? -


i want run custom java code/program on single node hadoop cluster. how run java program in single node cluster in hadoop? need convert java code jar file , execute?

yes, need convert .jar file. explain step step

1)write java code in eclipse ide.

2)to create jar of project, follow this link

3)copy dataset hdfs using following command

$ bin/hadoop dfs -copyfromlocal /path/to/file/on/filesystem /path/to/input/on/hdfs 

4)run jar giving path of dataset stored in hdfs, can follow command

$ bin/hadoop jar path/to/jar/on/filesystem /path/to/input/on/hdfs /path/to/outputdir/on/hdfs 

5)the following command used verify resultant files in output folder.

$ bin/hadoop fs -ls /path/to/outputdir/on/hdfs 

6)the following command used see output in part-00000 file. file generated hdfs.

$ bin/hadoop fs -cat path/to/output_dir/part-00000  

hope helps you.


Comments

Popular posts from this blog

jsf - "PropertyNotWritableException: Illegal Syntax for Set Operation" error when setting value in bean -

arrays - Algorithm to find ideal starting spot in a circle -

php - Autoloader issue not returning Class -