同一组机器上的独立 Ignite 集群
Isolated Ignite clusters on same set of machines
我正在使用 Apache.Ignite NET 2.12.0.
我尝试了几种方法来让两个 Ignite 集群在机器上分开 运行:
- 描述的方法here。我为每个服务器实例指定了 DiscoverySPI 和 CommunicationSPI 端口(我使用客户端-服务器模型)来隔离它们,但是服务器无法 运行 并显示此警告:
[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]
那样的话,执行进入Ignition.Start,不要离开
- 我试图为 IgniteConfiguration.SslContextFactory 提供不同的证书以避免不同的集群相互看到,但在那种情况下 - 它们相互看到,但集群无法相互连接,这会阻止它们工作.
有什么简单的方法可以做到这一点吗?
文档中的方法有效,这里是相应的 C# 代码,使用 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);
打印:
Cluster 1 nodes: 2
Cluster 2 nodes: 3
证明我们有两个独立的集群。
我正在使用 Apache.Ignite NET 2.12.0.
我尝试了几种方法来让两个 Ignite 集群在机器上分开 运行:
- 描述的方法here。我为每个服务器实例指定了 DiscoverySPI 和 CommunicationSPI 端口(我使用客户端-服务器模型)来隔离它们,但是服务器无法 运行 并显示此警告:
[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]
那样的话,执行进入Ignition.Start,不要离开
- 我试图为 IgniteConfiguration.SslContextFactory 提供不同的证书以避免不同的集群相互看到,但在那种情况下 - 它们相互看到,但集群无法相互连接,这会阻止它们工作.
有什么简单的方法可以做到这一点吗?
文档中的方法有效,这里是相应的 C# 代码,使用 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);
打印:
Cluster 1 nodes: 2
Cluster 2 nodes: 3
证明我们有两个独立的集群。