I'm using Apache.Ignite NET 2.12.0.
I tried several approaches to allow two Ignite clusters to be run separately on the machine:
[05:03:01,968][WARNING][main][TcpDiscoverySpi] Failed to connect to any address from IP finder (make sure IP finder addresses are correct and firewalls are disabled on all host machines): [/127.0.0.1:47501, /127.0.0.1:47502]
In that case, the execution enters Ignition.Start and don't leave it.
Is there some easy way to do this?
The approach from the docs works, here is the corresponding C# code, tested with Ignite.NET 2.12:
static IgniteConfiguration GetConfig(int port, int portRange) =>
new IgniteConfiguration
{
DiscoverySpi = new TcpDiscoverySpi
{
IpFinder = new TcpDiscoveryStaticIpFinder
{
Endpoints = new[]
{
$"127.0.0.1:{port}..{port + portRange}"
}
},
LocalPort = port,
LocalPortRange = portRange
},
CommunicationSpi = new TcpCommunicationSpi
{
LocalPort = port - portRange,
LocalPortRange = portRange
},
AutoGenerateIgniteInstanceName = true
};
var clusterCfg1 = GetConfig(49500, 10);
var clusterCfg2 = GetConfig(49700, 10);
var cluster1Node1 = Ignition.Start(clusterCfg1);
var cluster1Node2 = Ignition.Start(clusterCfg1);
var cluster2Node1 = Ignition.Start(clusterCfg2);
var cluster2Node2 = Ignition.Start(clusterCfg2);
var cluster2Node3 = Ignition.Start(clusterCfg2);
Console.WriteLine("Cluster 1 nodes: " + cluster1Node1.GetCluster().GetNodes().Count);
Console.WriteLine("Cluster 2 nodes: " + cluster2Node1.GetCluster().GetNodes().Count);
Prints:
Cluster 1 nodes: 2
Cluster 2 nodes: 3
Proving that we have two separate clusters.