所以我已将Apache Ignite.NET实例配置为以服务器身份运行:
var cfg = new IgniteConfiguration
{
CommunicationSpi = new TcpCommunicationSpi
{
LocalPort = config.CommunicationPort,
LocalPortRange = config.CommunicationPortRange,
MaxConnectTimeout = TimeSpan.FromMilliseconds(10000),
ConnectTimeout = TimeSpan.FromMilliseconds(1000)
},
AutoGenerateIgniteInstanceName = true,
ClientMode = false,
IsActiveOnStart = true,
DiscoverySpi = new TcpDiscoverySpi
{
LocalPort = config.DiscoveryPort,
LocalPortRange = config.DiscoveryPortRange,
ForceServerMode = true,
LocalAddress = localAddress,
IpFinder = new TcpDiscoveryStaticIpFinder
{
Endpoints = config.ClusterEndPoints
}
},
Localhost = config.LocalAddress,
};
我使用ForceServerMode = true,在DiscoverySpi.Endpoints中,我有我的本地IP以及我的群集的IP列表。
我所看到的是,由于某种原因,加入通过点燃超时调用。这是我得到的异常日志:
Level: [Error], Message:[Exception on direct send: connect timed out] Native:[java.net.SocketTimeoutException: connect timed out
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi.openSocket(TcpDiscoverySpi.java:1376)
at org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi.openSocket(TcpDiscoverySpi.java:1339)
at org.apache.ignite.spi.discovery.tcp.ServerImpl.sendMessageDirectly(ServerImpl.java:1159)
at org.apache.ignite.spi.discovery.tcp.ServerImpl.sendJoinRequestMessage(ServerImpl.java:1006)
at org.apache.ignite.spi.discovery.tcp.ServerImpl.joinTopology(ServerImpl.java:851)
at org.apache.ignite.spi.discovery.tcp.ServerImpl.spiStart(ServerImpl.java:358)
at org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi.spiStart(TcpDiscoverySpi.java:1834)
at org.apache.ignite.internal.managers.GridManagerAdapter.startSpi(GridManagerAdapter.java:297)
at org.apache.ignite.internal.managers.discovery.GridDiscoveryManager.start(GridDiscoveryManager.java:837)
at org.apache.ignite.internal.IgniteKernal.startManager(IgniteKernal.java:1770)
at org.apache.ignite.internal.IgniteKernal.start(IgniteKernal.java:977)
at org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start0(IgnitionEx.java:1896)
at org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start(IgnitionEx.java:1648)
at org.apache.ignite.internal.IgnitionEx.start0(IgnitionEx.java:1076)
at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:574)
at org.apache.ignite.internal.processors.platform.PlatformAbstractBootstrap.start(PlatformAbstractBootstrap.java:48)
at org.apache.ignite.internal.processors.platform.PlatformIgnition.start(PlatformIgnition.java:76)
这很好,也许有一些网络问题,分区,防火墙等等。我可以搞清楚。
我不明白为什么启动ingite节点的呼叫会挂起。我希望它尝试连接到那些端点,如果不能,它应该只是启动本地节点。这是我如何开始我的节点
Ignition.Start(cfg);
相反,我看到它一直在尝试加入这些超时日志,并且它永远不会停止,应用程序会无限期挂起。
我错过了一些配置,让Ignite放弃尝试连接,只是启动本地模式,或者只是完全失败。
[编辑] 这只发生在我已经有其他应用程序在群集中运行点火并且此新节点尝试通过静态ips加入现有群集时(并且它的网络配置错误,阻止它与现有群集通信) )。如果我尝试启动这个新节点,并且没有已经运行的点火实例,它就不会挂起,它只是继续并启动本地点燃节点。