Running the Application
Step 0: Package your application
First, you will need to create JAR with our application and its dependencies. You can do this by running the following command in the top of the project directory.
This will create the JAR file target/wordcount-jar-with-dependencies.jar
which you can use to upload to Grainite. Note: If you make any changes to your application after packaging, you'll need to re-run the above command or mvn clean package
.
Step 1: Load your application onto Grainite
Step 1.1: Replace existing sample WordCount app running on Grainite
You can check if an app with the same name is already loaded onto Grainite, for example, if you previously tested the pre-built WordCount app before building your own in this tutorial. Running the following GX command:
We see that the pre-built app called 'wordcount' is already loaded. By default, your application will have the same name, as specified in the YAML file. You should first remove the currently loaded app with:
Step 1.2: Load your packaged app onto Grainite
With the JAR file you created above, you can use the following command to load your app onto Grainite.
Note: gx load
uses localhost
as the default host server IP. If Grainite has provided you with a trial server instance, you will need to specify it as the host: Run the gx load -H <SERVER IP>
command below, using the IP address given to you.
Step 2: Run the application
Now that your application is loaded onto Grainite, you can now run WordCount commands through the client. First, you'll need a text file to pass to the client as input. You can use the following files from samples/wordcount/resources
:
To run the client application and push events into Grainite, you can use the run.sh
script under samples/wordcount/templates
(not the run.sh in the parent directory). Copy run.sh
into your my-wordcount
directory.
First, set the new script as executable.
Now, you can load some input data onto your app:
Congrats! You've completed the WordCount tutorial and learned how to build a Grainite application from scratch.
Last updated