Submit a Java-developed WordCount program to the spark cluster to run

Source: Internet
Author: User

Share today the steps to submit the Java-developed WordCount program to the spark cluster.

Before the first step, upload the text file, Spark.txt, and then use the command Hadoop fs-put spark.txt/spark.txt.

First: Look at the entire Code view

Open the Wordcountcluster.java source file and modify the code here:

Step Two:

To make a good jar package, step right-click the project file----Runas--run configurations

Fill in the picture, then start copying the jar package under the project, and note that the dependent jar package is copied, not the second one.

The jar and another file wordcount.sh to the desktop are then uploaded to the platform and dragged onto the platform.

Start using the upload command for Hadoop fs-put Spark.txt/spark.txt.

The third step: to start the Hadoop cluster, see the Hadoop configuration blog, note that if the cluster inside the Datanode or one of the Namenode does not start, find such a directory, and delete the files inside, restart, that is, the home directory files

Open the Hadoop----DFS-----in the home directory and remove all two directories

Fourth step: The Hadoop cluster is now started, then we start to modify the wordcount.sh configuration file

Some notes:

The 1,class directory must correspond to the project directory under your Eclipse project

2, about the Spark-submit submission tool, the path is consistent with the path above your spark cluster, looking for files in the bin directory under the Spark cluster, not files under Spark-study, remember

3, the last line path is your upload program jar package to the platform after the path, note must be suffix jar file package, cannot upload other suffix name, all invalid.

4, note: Modify the local Eclipse program files, must be effective, it is necessary to re-upload packaging, and then deploy.

The fifth step, start the program file, that is, in the wordcount.sh configuration file directory, execute the following command to

Submit a Java-developed WordCount program to the spark cluster to run

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.