Usage
Compile WordCount.java:
$ mkdir wordcount_classes $ javac -cp classpath -d wordcount_classes WordCount.java
where classpath is:
- CDH4 - /usr/lib/hadoop/*:/usr/lib/hadoop/client-0.20/*
- CDH3 - /usr/lib/hadoop-0.20/hadoop-0.20.2-cdh3u4-core.jar
Create a JAR:
$ jar -cvf wordcount.jar -C wordcount_classes/ .
Assuming that:
- /user/cloudera/wordcount/input - input directory in HDFS
- /user/cloudera/wordcount/output - output directory in HDFS
Create sample text files as input and move to HDFS:
$ echo "Hello World Bye World" > file0 $ echo "Hello Hadoop Goodbye Hadoop" > file1 $ hadoop fs -mkdir /user/cloudera /user/cloudera/wordcount /user/cloudera/wordcount/input $ hadoop fs -put file* /user/cloudera/wordcount/input
Run the application:
$ hadoop jar wordcount.jar org.myorg.WordCount /user/cloudera/wordcount/input /user/cloudera/wordcount/output
Output:
$ hadoop fs -cat /user/cloudera/wordcount/output/part-00000 Bye 1 Goodbye 1 Hadoop 2 Hello 2 World 2
Applications can specify a comma-separated list of paths that would be present in the current working directory of the task using the option -files. The -libjars option allows applications to add JARs to the classpaths of the maps and reduces. The -archives allows them to pass archives as arguments that are unzipped/unjarred and a link with name of the zip/JAR are created in the current working directory of tasks. More details about the command line options are available at Hadoop Command Guide.
Running wordcount example with -libjars and -files:
hadoop jar hadoop-examples.jar wordcount -files cachefile.txt -libjars mylib.jar input output
Cloud is one of the tremendous technology that any company in this world would rely on(Salesforce developer training in chennai). Using this technology many tough tasks can be accomplished easily in no time. Your content are also explaining the same(Salesforce training institutes in chennai). Thanks for sharing this in here. You are running a great blog, keep up this good work.
ReplyDeleteThank you for your comments
DeleteThank you for your comments
ReplyDeleteAn extremely informative and interesting blog among all you have shared. Update it frequently.
ReplyDeleteTOEFL Coaching in Chennai
Best TOEFL Coaching Institute in Chennai
TOEFL Classes in Chennai
TOEFL Training in Chennai
IELTS Classes in Mumbai
Spoken English Classes in JP Nagar
Spoken English Class in Thiruvanmiyur
Spoken English Classes in Chennai
English Speaking Classes in Mumbai
I am really enjoying reading your well written articles.
ReplyDeleteIt looks like you spend a lot of effort and time on your blog.
I have bookmarked it and I am looking forward to reading new articles.Keep up the good work..
RPA Training in Chennai
RPA Classes in Chennai
Blue Prism Training in Chennai
Ethical Hacking Training in Chennai
Cloud Computing Training in Chennai
RPA Training in T Nagar
RPA Training in Porur
I am really enjoying reading your well written articles.
ReplyDeleteIt looks like you spend a lot of effort and time on your blog.
I have bookmarked it and I am looking forward to reading new articles.Keep up the good work..
RPA Training in Chennai
RPA Classes in Chennai
Blue Prism Training in Chennai
Ethical Hacking Training in Chennai
Cloud Computing Training in Chennai
RPA Training in T Nagar
RPA Training in Porur
Thanks for sharing valuable information.It will help everyone.keep Post.
ReplyDeleteKerala Lottery guessing
The knowledge of technology you have been sharing thorough this post is very much helpful to develop new idea. here by i also want to share this.
ReplyDeleteBig Data Hadoop Training In Chennai | Big Data Hadoop Training In anna nagar | Big Data Hadoop Training In omr | Big Data Hadoop Training In porur | Big Data Hadoop Training In tambaram | Big Data Hadoop Training In velachery
Automated Forex Trading With FBS Metatrader 4 - Download .
ReplyDelete