Apache Ignite Sample Program Put To Cache and Get From Cache

In our previous tutorial, we had setup a multi-node ignite cluster on a windows machine. Let’s extend it with our first program involving apache ignite. In this tutorial, we will create a cache in a single server ignite cluster; add some values and retrieve it back. I’ll demonstrate this tutorial with eclipse IDE. If you are using any other IDE, you can modify some eclipse specific instructions accordingly.

Followings are used as part of this activity:


  1. Launch eclipse with any workspace of your choice. In my case, the workspace is “”F:\workspace\java\ignite”.
  2. In the project explorer, right click to create New -> Project … From the New Project dialog, select “Maven Project” wizard. Click Next > buton couple of times and go to the window where you need to specify Group Id, Artifact id and Package and click on Finish button. I have set the followings as the value –
  3. Next, we’ll update the pom.xml with the required dependencies. For me, it’s the exact like below –

  4. Next, time to write a very simple JAVA program that will join a pre-existing single node ignite server cluster as a client; it’ll create a cache, put some values and retrieve the same from cache.
  5. Right click on the package “com.iteritory.ignite.ignitetutorial” in package explorer and create a new JAVA class called “FirstProgram.java”. My program looks as below –

  6. The package structure looks like below –
  7. Next we’ll create itc-poc-config.xml; the content is as below –

  8. Next, launch command prompt and change directory to %IGNITE_HOME%/bin
  9. Run command –> ignite.bat F:\apache-ignite-fabric-2.0.0-bin\config\itc-poc-config.xml
  10. After the server starts, we’ll see last few lines are something similar to following – 
  11. Now, that server is running, we will run above JAVA program as an application from eclipse. In a while, you will see something like following – 
  12.  If you analyze the result above, the JAVA program we wrote, joined the cluster as a node; hence, the client became 0 to 1. You can see the same from the server log as well. If you open the command window where we ran the ignite.bat file, you will see a new line; let’s have a look into following screenshot from the server logs –
  13. The other part of the result in step 11, outputs the 4 names, we inserted into the cache from the program itself.
  14. So, to conclude, this tutorial gives a basic overview of apache ignite client and server node; how a client node joins the server, how to create a simple cache in apache ignite, how to put data in apache ignite cache and how to retrieve data from cache.

6 Responses

  1. Nikita
    February 8, 2018
    • Sadruddin Md
      February 9, 2018
      • vb
        February 22, 2018
  2. Nek
    July 18, 2018
  3. Sadruddin Md
    July 18, 2018
  4. Nek
    July 23, 2018

Write a response

This site uses Akismet to reduce spam. Learn how your comment data is processed.