This chapter explains system requirements for running Ignite and how to install Ignite, start a cluster, and run a simple Hello World example in C++.
Ignite C++ was officially tested on:
|
Note
|
Ignite for C++ supports a thick client and a thin client. Because this guide focuses on the thin client, you can run the examples below, connecting to the Java-based nodes you just started. |
Once the cluster is started, you can use the Ignite C++ thin client to perform cache operations (things like getting or putting data, or using SQL).
Ignite ships with a robust C++ client. To get started with Ignite and C++, you will need to be familiar with building C++ applications.
-
If you haven’t already, download/install Apache Ignite.
-
Install
CMake 3.6+and add it to the%Path%. -
Install
OpenSSL. -
Set
%JAVA_HOME%environment variable. -
Navigate to the
%IGNITE_HOME%\platforms\cpp\folder. -
Create build directory
%IGNITE_HOME%\platforms\cpp\cmake-build-release. -
Build and install
Ignite C++.
tab:Win32[]
cd cmake-build-release
cmake .. -DWITH_THIN_CLIENT=ON -DCMAKE_GENERATOR_PLATFORM=Win32 -DOPENSSL_ROOT_DIR=<openssl install dir> -DCMAKE_INSTALL_PREFIX=<ignite cpp install dir>
cmake --build . --target install --config Releasetab:Win64[]
cd cmake-build-release
cmake .. -DWITH_THIN_CLIENT=ON -DCMAKE_GENERATOR_PLATFORM=x64 -DOPENSSL_ROOT_DIR=<openssl install dir> -DCMAKE_INSTALL_PREFIX=<ignite cpp install dir>
cmake --build . --target install --config ReleaseCMake by default generates on Windows Visual Studio projects. You can find generated projects in CMake
build directory and open Ignite.C++.sln in Visual Studio.
From here, you can create your own code, or run one of the existing examples located in the {IGNITE_HOME}/platforms/cpp/examples/ directory.
There is much more information about how to build, test, and use Apache Ignite for C++ in the README.txt and
DEVNOTES.txt files located in the {IGNITE_HOME}/platforms/cpp folder.
For information about the C++ thin client, see C++ Thin Client.
On unix systems, you can use the command line to build and run the examples included in the Ignite distribution.
-
Download and unzip the Ignite binary release. We’ll refer to a resulting directory as to
${IGNITE_HOME}. -
Create a build directory for CMake. We’ll refer to this as
${CPP_BUILD_DIR} -
Build and install Ignite.C++ by executing the following commands:
tab:Ubuntu[]
cd ${CPP_BUILD_DIR}
cmake -DCMAKE_BUILD_TYPE=Release -DWITH_THIN_CLIENT=ON ${IGNITE_HOME}/platforms/cpp
make
sudo make installtab:CentOS/RHEL[]
cd ${CPP_BUILD_DIR}
cmake3 -DCMAKE_BUILD_TYPE=Release -DWITH_THIN_CLIENT=ON ${IGNITE_HOME}/platforms/cpp
make
sudo make install-
Create a build directory for cmake. We’ll refer to it as
${CPP_EXAMPLES_BUILD_DIR} -
Build the examples by executing the following commands:
tab:Ubuntu[]
cd ${CPP_EXAMPLES_BUILD_DIR}
cmake -DCMAKE_BUILD_TYPE=Release ${IGNITE_HOME}/platforms/cpp/examples && make
cd ./put-get-example
./ignite-put-get-exampletab:CentOS/RHEL[]
cd ${CPP_EXAMPLES_BUILD_DIR}
cmake3 -DCMAKE_BUILD_TYPE=Release ${IGNITE_HOME}/platforms/cpp/examples && make
cd ./put-get-example
./ignite-put-get-exampleFrom here, you may want to:
-
Check out the C++ thin client that provides a lightweight form of connectivity to Ignite clusters
-
Explore the additional C++ examples included with Ignite
-
Refer to the C++ specific section of the documentation to learn more about capabilities that are available for C++ applications