GridGain Developers Hub
GitHub logo GridGain iso GridGain.com
GridGain Software Documentation

GridGain for C++

This chapter explains system requirements for running GridGain and how to install GridGain, start a cluster, and run a simple Hello World example in C++.

Since GridGain is built on top of Apache Ignite, GridGain reuses Ignite’s system properties, environment properties, startup scripts, etc. wherever possible.

Prerequisites

GridGain C++ was officially tested on:

JDK

Oracle JDK 8 and later, Open JDK 8 and later, IBM JDK 8 and later

OS

Linux (any flavor), Mac OSX (10.6 and up), Windows (XP and up), Windows Server (2008 and up), Oracle Solaris

ISA

x86, x64, SPARC, PowerPC

Network

No restrictions (10G recommended)

and:

Visual Studio

2010 and above

Installing GridGain

GridGain is available in three editions: Community Edition (CE), Enterprise Edition (EE) and Ultimate Edition (UE). For this example, we’ll use the GridGain CE, which is distributed as binary, docker, and cloud images, and via RPM/DEB. This chapter explains how to install the GridGain CE binary distribution.

To get started with the GridGain CE binary distribution:

  1. Download the GridGain binary as a zip archive.

  2. Unzip the zip archive into the installation folder in your system.

  3. Move the ignite-rest-http folder from {gridgain}/libs/optional to {gridgain}/libs to enable the Ignite REST library for the cluster. The library is used by GridGain Web Console for cluster management and monitoring needs.

  4. (Optional) Enable required modules.

  5. (Optional) Set the IGNITE_HOME environment variable or Windows PATH to point to the installation folder and make sure there is no trailing / (or \ for Windows) in the path.

Starting a GridGain Node

You can start a GridGain node from the command line using the default configuration or by passing a custom configuration file. You can start as many nodes as you like and they will all automatically discover each other.

Navigate into the bin folder of GridGain installation directory from the command shell. Your command might look like this:

$ cd {gridgain}/bin/
$ cd {gridgain}\bin\

Start a GridGain node with a custom configuration file that is passed as a parameter to ignite.sh|bat like this:

$ ./ignite.sh examples/config/example-ignite.xml
$ ignite.bat examples\config\example-ignite.xml

You will see output similar to this:

[08:53:45] Ignite node started OK (id=7b30bc8e)
[08:53:45] Topology snapshot [ver=1, locNode=7b30bc8e, servers=1, clients=0, state=ACTIVE, CPUs=4, offheap=1.6GB, heap=2.0GB]

Open another tab from your command shell and run the same command again:

$ ./ignite.sh examples/config/example-ignite.xml
$ ignite.bat examples\config\example-ignite.xml

Check the Topology snapshot line in the output. Now you have a cluster of two server nodes with more CPUs and RAM available cluster-wide:

[08:54:34] Ignite node started OK (id=3a30b7a4)
[08:54:34] Topology snapshot [ver=2, locNode=3a30b7a4, servers=2, clients=0, state=ACTIVE, CPUs=4, offheap=3.2GB, heap=4.0GB]

Once the cluster is started, you can use the GridGain C++ thin client to perform cache operations (things like getting or putting data, or using SQL).

Getting Started with GridGain and C++

GridGain ships with a robust C++ client. To get started with GridGain and C++, you will need to be familiar with building C++ applications (GridGain CE ships with Visual Studio solution files to help make this easier) so that you can build GGCE for C++ from the source files.

  1. Install openssl and add it to your path.

  2. If you haven’t already, download/install GridGain CE.

  3. Navigate to the {gridgain_dir}/platforms/cpp/project/vs folder.

  4. Launch the appropriate Visual Studio solution file for your system (ignite.sln is for 64-bit).

  5. Build the solution.

From here, you can create your own code, or run one of the existing examples located in the {gridgain_dir}/platforms/cpp/examples/project/vs directory.

There is much more information about how to build, test, and use GGCE for C++ in the readme.txt and DEVNOTES.txt files located in the {gridgain_dir}/platforms/cpp folder.

For information about the C++ thin client, see C++ Thin Client.

C++ for Unix

On unix systems, you can use the command line to build and run the examples included in the GridGain distribution.

Prerequisites

The following packages should be installed: - C++ compiler - libssl - autotools - automake - libtool

Building C++ Ignite

  1. Download and unzip the GridGain binary release into a directory. We’ll refer to this as {gridgain_dir}.

  2. cd {gridgain_dir}/platforms/cpp

  3. libtoolize && aclocal && autoheader && automake --add-missing && autoreconf

  4. ./configure

  5. make

Running the Thick Client Example

  1. cd {gridgain_dir}/platforms/cpp/examples

  2. libtoolize && aclocal && autoheader && automake --add-missing && autoreconf

  3. ./configure

  4. cd put-get-example

  5. make

  6. ./ignite-put-get-example

Next Steps

From here, you may want to:

Using GridGain Web Console

GridGain Web Console is an interactive configuration, management, and monitoring tool, built on top of Apache Ignite Web Console.

  1. Go to https://console.gridgain.com and create an account.

  2. Log in with your new account and go to the "Monitoring Dashboard" screen. Click the three horizontal lines at the top in order to expand the left-hand menu:

    Web Console Left Nav
  3. Click the "Download Agent" button as shown in the screenshot below:

    Download the Web Console Agent
  4. Extract the web agent into a separate folder.

  5. Navigate to the folder where you extracted the web agent files, and execute the ignite-web-agent.sh (or ignite-web-agent.bat) script.

  6. Ensure that the agent can connect to both console.gridgain.com and your single node cluster started earlier. Look for messages similar to the following in the agent’s log:

    Web Console Log
  7. Go back to the console.gridgain.com Monitoring Dashboard and refresh it. Confirm that the tool successfully displays metrics for your local single node cluster.