Raymond Raymond

Apache Ignite Installation on Windows

event 2022-01-03 visibility 1,795 comment 0 insights toc
more_vert
insights Stats

I love Apache open source frameworks and you probably have noticed that I spent a lot time in the past to publish detailed installation guides on Windows for products like Hadoop, Spark, Hive, Kafka, Ambari, Zeppelin, etc. Apache Ignite is a distributed database for high‑performance applications with in‑memory speed. The core capabilities include multi-tier storage, distributed SQL, ACID transactions, compute APIs in Java, Scala, Kotlin, C# and C++, machine learning and continuous queries. 

This article provides a simple guide to install Ignite on your Windows machine for learning and practice purposes. You can also use Docker or Kubernetes to install Apache Ignite.

Prerequisites

  • JDK: Oracle JDK 8 or 11, Open JDK 8 or 11, IBM JDK 8 or 11.
  • .NET SDK: only required if you want to run the .NET thin client example.

You can follow section 'Step 4 - (Optional) Java JDK installation' in article Install Hadoop 3.3.1 on Windows 10 Step by Step Guide.

Install Ignite

Follow these steps to install Apache Ignite:

  1. Download binary: https://ignite.apache.org/download.cgi#binaries.
    For this article, I am downloading 2.11.1 version (apache-ignite-2.11.1-bin.zip). 
  2. Unzip the binary to the installation folder using PowerShell:
    unzip  apache-ignite-2.11.1-bin.zip
  3. (Optional) Enable required modules. Follow this official link to learn more about enabling required modules: Enabling Modules.
  4. Setup Ignite environment variable IGNITE_HOME:
    2022010310700-image.png
    Make sure there is no trailing path separator ('\' or '/') in the value.

Configure Ignite

Now we can configure Ignite based accordingly.

Configure working directory

Working directory is the place where your application data is stored.

SETX IGNITE_WORK_DIR=F:\big-data\apache-ignite-2.11.1-bin\work

By default, it locates at %IGNITE_HOME%\work. You can also customize in your applications or using environment variable IGNITE_WORK_DIR.

Configure logging

Ignite supports many different logging libraries and frameworks including JUL (default), Log4j, Log4j2, JCL and SLF4J. By default JUL is used. You can use The following environment variables can be configured:

System propertyDescriptionDefault value
IGNITE_LOG_INSTANCE_NAMEIf the property is set, Ignite includes its instance name in log messages.Not set
IGNITE_QUIETSet to false to disable the quiet mode and enable the verbose mode. true
IGNITE_LOG_DIRThe directory where Ignite writes log files.
%IGNITE_HOME%\work\log
IGNITE_DUMP_THREADS_ON_FAILURESet to true to output thread dumps to the log when a critical error is caught.
true

By default, Ignite uses %IGNITE_HOME%\config\java.util.logging.properties as logging configuration file. 

Start Ignite nodes

Start server node

After all the configurations, we can start server node using the following command line in Command Prompt:
%IGNITE_HOME%\bin\ignite.bat

2022010313928-image.png

Enable client node

We can enable client node by configuring the default config file or enable it programmatically in your Java, .NET or C++ applications.

To use XML configuration file, configure property clientMode as true

<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements. See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License. You may obtain a copy of the License at
       http://www.apache.org/licenses/LICENSE-2.0
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="
       http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans.xsd">
    <!--
        Alter configuration below as needed.
    -->
    <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
  <property name="clientMode" value="true"/>
 </bean>
</beans>

Start client node

Once you configured to enable client mode in your computer, you can then start it using same command.

Stop nodes

You can directly press Ctrl + C to stop the node services.

(Optional) .NET thin client example

Now we can implement an example following page .NET Thin Client.

1) Create a dotnet application:

mkdir ignite-dotnet-example
cd ignite-dotnet-example
dotnet new console

2) Add package reference

The required package is already part of Ignite binary distribution and locates at: %IGNITE_HOME%\platforms\dotnet\bin\Apache.Ignite.Core.dll.

Edit project file to reference this local library by adding the following element:

<ItemGroup>
  <Reference Include="Apache.Ignite.Core">
    <HintPath>F:\big-data\apache-ignite-2.11.1-bin\platforms\dotnet\bin\Apache.Ignite.Core.dll</HintPath>
  </Reference>
</ItemGroup>

* Remember to change the path accordingly.

3) Edit Program.cs file with the following content:

using Apache.Ignite.Core;
using Apache.Ignite.Core.Client;
var cfg = new IgniteClientConfiguration
{
    Endpoints = new[] { "127.0.0.1:10800" }
};
using (var client = Ignition.StartClient(cfg))
{
    var cache = client.GetOrCreateCache<int, string>("cache");
    cache.Put(1, "Hello, World!");
    foreach (var cacheName in client.GetCacheNames())
        Console.WriteLine(cacheName);
    Thread.Sleep(1000);
    foreach (IClientConnection connection in client.GetConnections())
    {
        Console.WriteLine(connection.RemoteEndPoint);
    }
}

4) Run the program:

dotnet run

Output:

cache
127.0.0.1:10800

References

Ignite Documentation Overview

More from Kontext
comment Comments
No comments yet.

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts