Can not connect Apache Ignite on Azure Kuberntes from .net core app

4/15/2020

I am new to Ignite and Kubernetes. I have a.Net Core 3.1 web application which is hosted Azure Linux App Service.

I followed the instructions (Apache Ignite Instructions Offical Site) and Apache Ignite could run on Azure Kubernetes. I could create a sample table and read-write actions worked successfully. Here is the screenshot of my success tests on PowerShell.

Please see the success test

Now, I try to connect Apache Ignite from my .net core web app but I couldn't make it. My code is as below. I try to connect with IgniteConfiguration and SpringCfgXml, but both of them getting error.

private void Initialize()
{
    var cfg = GetIgniteConfiguration();
    _ignite = Ignition.Start(cfg);
    InitializeCaches();
}

public IgniteConfiguration GetIgniteConfiguration()
{
    var appSettingsJson = AppSettingsJson.GetAppSettings();
    var igniteNodes = appSettingsJson["AppSettings:IgniteNodes"];
    var nodeList = igniteNodes.Split(",");
    var config = new IgniteConfiguration
    {
        Logger = new IgniteLogger(),
        DiscoverySpi = new TcpDiscoverySpi
        {
            IpFinder = new TcpDiscoveryStaticIpFinder
            { 
                Endpoints = nodeList
            },
            SocketTimeout = TimeSpan.FromSeconds(5)
        },
        IncludedEventTypes = EventType.CacheAll,
        CacheConfiguration = GetCacheConfiguration()
    };
    return config;
}

The first error I get:

Apache.Ignite.Core.Common.IgniteException HResult=0x80131500
Message=Java class is not found (did you set IGNITE_HOME environment variable?): org/apache/ignite/internal/processors/platform/PlatformIgnition
Source=Apache.Ignite.Core

Also, I have no idea what I am gonna set for IGNITE_HOME, and username and secret to authentication.

-- Oğuz Kaan Akyalçın
.net-core
azure
azure-kubernetes
ignite
kubernetes

2 Answers

4/15/2020

The simplest way is to download Apache Ignite binary distribution (of the same version as one that you use), unzip it to a directory, and point IGNITE_HOME environment variable or IgniteConfiguration.IgniteHome configuration property to unzipped apache-ignite-n.n.n-bin/ directory absolute path.

We support doing that automatically for Windows-hosted apps but not for Linux-based deployments.

-- alamar
Source: StackOverflow

4/15/2020

Solution : I finally connect the Ignite on Azure Kubernetes.

Here is my connection method.

public void TestConnection()
{
    var cfg = new IgniteClientConfiguration
    {
        Host = "MyHost",
        Port = 10800,
        UserName = "user",
        Password = "password"
    };

    using (IIgniteClient client = Ignition.StartClient(cfg))
    {
        var employeeCache1 = client.GetOrCreateCache<int, Employee>(
            new CacheClientConfiguration(EmployeeCacheName, typeof(Employee)));

        employeeCache1.Put(1, new Employee("Bilge Wilson", 12500, 1));
    }
}

To find to host IP, user name and client secret please check the below images.

Client Id and Secret enter image description here

IP Addresses enter image description here

Note: I don't need to set any IGNITE_HOME ana JAVA_HOME variable.

-- Oğuz Kaan Akyalçın
Source: StackOverflow