This is a very very simple mapreduce application. You can run this application in command with following command.
./gradlew run
This command will download all the jars to your local machine. No hadoop installation package is required, no setting is required, just issue the command and does work!!
The output would print this information
The output goes to: out/20140520170354
Just use
cat out/20140520170354/part-r-00000
To see the result.
Please follow the steps below
-
Issue this command to create the eclise project files
./gradlew eclipse
-
Open the eclipse. Select the "Import" > "Existing Projects into Workspace".
-
Run as application
I assume that your have knowledge to set up the hadoop standalone server or cluster. Please follow the steps below
-
Issue this command to create the executable jar
./gradlew jar
-
Run in hadoop
hadoop jar build/libs/wordcount.jar
Good luck and happy MapReduce!!!
To make this example more-Hadoop-like, and make it run more smoothly under HDInsight, I add a new task 'hadoop', and define an argument named 'args' to pass all the required parameters. ( Thank @MonsterSupreme )