You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

本地服务连接远程Ignite节点失败:无法向远程节点发送消息

远程Ignite节点连接报错:Failed to send Message to remote node

本地服务连接远程服务器上的Ignite节点时,出现"Failed to send Message to remote node"错误,配置代码和报错日志如下:

配置代码

IgniteConfiguration igniteConfig = new IgniteConfiguration();
igniteConfig.setIgniteInstanceName("MasterCacheCluster");
igniteConfig.setPeerClassLoadingEnabled(true);
igniteConfig.setClientMode(true);
TcpDiscoverySpi discoverySpi = new TcpDiscoverySpi();
TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();
TcpCommunicationSpi communicationSpi = new TcpCommunicationSpi();
 
ipFinder.setAddresses(Arrays.asList("server_address:47500..47509"));
discoverySpi.setIpFinder(ipFinder);
igniteConfig.setDiscoverySpi(discoverySpi);
DataStorageConfiguration dataCfg = new DataStorageConfiguration();
DataRegionConfiguration rgnCfg = new DataRegionConfiguration();
rgnCfg.setName("Sample_Cluster_Region");   
    
rgnCfg.setPageEvictionMode(DataPageEvictionMode.RANDOM_2_LRU);
rgnCfg.setPersistenceEnabled(true);
rgnCfg.setMetricsEnabled(true);
dataCfg.setDataRegionConfigurations(rgnCfg);

Ignite ignite = Ignition.start(igniteConfig);
ignite.cluster().active(true);
System.out.println("Cluster Size: " + ignite.cluster().nodes().size());
return ignite;

(注:服务器地址已隐去)

报错日志

[13:12:18,839][SEVERE][exchange-worker-#62%MasterCacheCluster%][TcpCommunicationSpi] Failed to send message to remote node [node=TcpDiscoveryNode [id=724fff2c-76c2-44e7-921f-b7c37dac7d15, consistentId=7c4ed309-0b9b-40ba-84a1-90384e0940ea, addrs=ArrayList [0:0:0:0:0:0:0:1%lo, server_address, 127.0.0.1], sockAddrs=null, discPort=47500, order=1, intOrder=1, lastExchangeTime=1676878928401, loc=false, ver=2.14.0#20220929-sha1:951e8deb, isClient=false], msg=GridIoMessage [plc=2, topic=TOPIC_CACHE, topicOrd=8, ordered=false, timeout=0, skipOnTimeout=false, msg=GridDhtPartitionsSingleMessage [parts=null, partCntrs=null, partsSizes=null, partHistCntrs=null, err=null, client=true, exchangeStartTime=1676878928573, finishMsg=null, super=GridDhtPartitionsAbstractMessage [exchId=GridDhtPartitionExchangeId [topVer=AffinityTopologyVersion [topVer=2, minorTopVer=0], discoEvt=DiscoveryEvent [evtNode=TcpDiscoveryNode [id=96f70bd7-cbfb-4a3e-900d-00a93b10d892, consistentId=96f70bd7-cbfb-4a3e-900d-00a93b10d892, addrs=ArrayList [0:0:0:0:0:0:0:1, 127.0.0.1, 172.16.16.50], sockAddrs=HashSet [/[0:0:0:0:0:0:0:1]:0, /127.0.0.1:0, LAPTOP-6AUCFF2I/172.16.16.50:0], discPort=0, order=2, intOrder=0, lastExchangeTime=1676878923997, loc=true, ver=2.14.0#20220929-sha1:951e8deb, isClient=true], topVer=2, msgTemplate=null, span=org.apache.ignite.internal.processors.tracing.NoopSpan@baed14f, nodeId8=96f70bd7, msg=null, type=NODE_JOINED, tstamp=1676878928556], nodeId=96f70bd7, evt=NODE_JOINED], lastVer=GridCacheVersion [topVer=0, order=1676878923547, nodeOrder=0, dataCenterId=0], super=GridCacheMessage [msgId=1, depInfo=null, lastAffChangedTopVer=AffinityTopologyVersion [topVer=-1, minorTopVer=0], err=null, skipPrepare=false]]]]]
class org.apache.ignite.IgniteCheckedException: Failed to connect to node (is node still alive?). Make sure that each ComputeTask and cache Transaction has a timeout set in order to prevent parties from waiting forever in case of network issues [nodeId=724fff2c-76c2-44e7-921f-b7c37dac7d15, addrs=[/server_address:47100, /[0:0:0:0:0:0:0:1%lo]:47100, /127.0.0.1:47100]]
解决方案
  • 检查端口开放情况:
    日志显示尝试连接远程节点的47100端口(默认通信端口),而配置的发现端口是47500..47509。确保远程服务器的47100端口和47500-47509端口都已在防火墙/安全组中开放,允许本地IP访问。
  • 配置通信端口一致性:
    如果远程节点修改了默认通信端口(47100),需在本地客户端配置中显式指定该端口:
    communicationSpi.setPort(远程通信端口);
    igniteConfig.setCommunicationSpi(communicationSpi);
    
  • 验证远程节点状态:
    确认远程Ignite节点正在运行,集群处于激活状态。可通过远程节点日志或Ignite控制台检查节点启动状态。
  • 调整远程节点地址绑定:
    远程节点地址列表包含本地回环地址,说明节点可能未绑定到对外可访问的IP。在远程节点配置中设置setLocalAddress为服务器公网/内网可访问IP:
    // 远程节点配置
    TcpDiscoverySpi remoteDiscoverySpi = new TcpDiscoverySpi();
    remoteDiscoverySpi.setLocalAddress("服务器可访问IP");
    
  • 设置通信超时:
    在通信SPI中配置合理超时,避免无限等待:
    communicationSpi.setConnectTimeout(5000); // 5秒连接超时
    communicationSpi.setSocketTimeout(30000); // 30秒套接字超时
    
  • 移除客户端激活集群操作:
    客户端模式下无需执行ignite.cluster().active(true),该操作应由集群服务端节点完成,删除该行代码减少不必要的交互。

内容的提问来源于stack exchange,提问作者Ritvik Rohatgi

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.31 11:35:21