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

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -