Setting up Apache ignite in your DICE account
If you use one of the DICE machines, Java, idea and Maven will be already installed. However, you need to configure Apache ignite in them.
Setting up Apache Ignite
Open a terminal.
Download the latest binary relase of Apache Ignite from here.
This will download a zipped file. Alternatively, you can use your favorite browser to download the same.wget http://mirror.ox.ac.uk/sites/rsync.apache.org//ignite/1.7.0/apache-ignite-fabric-1.7.0-bin.zip
Unzip the archive into the installation folder in your system
unzip apache-ignite-fabric-1.7.0-bin.zip
This will unzip the archive in the diectory named as apache-ignite-fabric-1.7.0-bin.Go inside apache-ignite-fabric-1.7.0-bin directory and run the ignite.sh script using
You should see the output in the terminal similar to:cd apache-ignite-fabric-1.7.0-bin bin/ignite.sh
If you see this output, then your apache ignite is running ok and you can proceed to the the next section.[12:06:57] Ignite node started OK (id=6a54a76f) [12:06:57] Topology snapshot [ver=1, servers=1, clients=0, CPUs=4, heap=1.0GB]
Running first cluster example - Hello World
Open a terminal.
Open Idea IDE
idea-ce &
First time usage for Idea would require you to setup launcher preferences. Setup as per your convinience.
You should see welcome screen like this:
Select "Create New Project".
Select "Maven" from the left side bar.
To select Project SDK click "New". Select Java-1.7.0 from the file browser
Click OK and then Next.
Enter GroupId as "example.hello" and ArtifactId as "example-hello". For better understanding refer here. Click Next
Select Project Name as "helloworld". Click Finish.
A project screen will be opened. Click on the "Enable Auto-import" in the "Maven projects to be imported" popup.
Create new package "example.hello" in src->main->java in the project window in the left hand side. Then Create a new Java class "HelloWorld" in it.
You need to add dependency for ignite-core, ignite-spring and h2 database. Your pom.xml should look like this.
Your HelloWorld.java should look like this.
Your project directory structure should look like this
Now make the project by clicking "Build->Make Project". On successful building the project, this would generate class files in target/classes directory.
Edit the run configuration by clicking "Run->Edit Configurations". Click on "+" and select "Applicaiton".
-
Enter "HelloWorld" as the "Name" of the configuration.
-
Enter "example.hello.HelloWorld" in "Main Class".
-
In "Configuration" tab, Enter "-DIGNITE_HOME=[path to apache-ignite-fabric-1.7.0-bin without /]" in "VM options". As we have spacified the relative path for the config file, this settings is needed. The configuration screen should look similar to this:
-
Open another terminal. Run ignite.sh with config file "examples/config/example-ignite.xml" as
bin/ignite.sh examples/config/example-ignite.xml
From Idea click Run->Run to run the program. You should see similar lines as below in the new terminal you have just opened in the previous step:
[14:22:27] Topology snapshot [ver=2, servers=2, clients=0, CPUs=16, heap=11.0GB] >>> Hello Node: 0103935b-9eee-49ce-a1ef-16341a3b352a