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