在 Apache Ignite 中连接网格中的 2 个节点时出错

Error while connecting 2 nodes in grid in Apache Ignite

在 Apache Ignite 中连接网格中的 2 个节点时出现以下错误。当我在两个节点上 运行 脚本 ignite.sh 时,这两个节点检测到自己。但是,当我尝试在一个节点上使用 ignite.sh 并在另一个节点上使用 java 代码启动 ignite 时,出现以下错误。

[17:23:44]    __________  ________________ 
[17:23:44]   /  _/ ___/ |/ /  _/_  __/ __/ 
[17:23:44]  _/ // (7 7    // /  / / / _/   
[17:23:44] /___/\___/_/|_/___/ /_/ /___/  
[17:23:44] 
[17:23:44] ver. 1.7.0#20160801-sha1:383273e3
[17:23:44] 2016 Copyright(C) Apache Software Foundation
[17:23:44] 
[17:23:44] Ignite documentation: http://ignite.apache.org
[17:23:44] 
[17:23:44] Quiet mode.
[17:23:44]   ^-- Logging to file '/opt/apache-ignite-fabric-1.7.0-bin/work/log/ignite-d9ec5b41.0.log'
[17:23:44]   ^-- To see **FULL** console log here add -DIGNITE_QUIET=false or "-v" to ignite.{sh|bat}
[17:23:44] 
[17:23:44] OS: Linux 2.6.32-431.el6.x86_64 amd64
[17:23:44] VM information: Java(TM) SE Runtime Environment 1.8.0_71-b15 Oracle Corporation Java HotSpot(TM) 64-Bit Server VM 25.71-b15
[17:23:44] Configured plugins:
[17:23:44]   ^-- None
[17:23:44] 
[17:23:45] Security status [authentication=off, tls/ssl=off]
[17:23:56,143][SEVERE][main][IgniteKernal] Failed to start manager: GridManagerAdapter [enabled=true, name=o.a.i.i.managers.discovery.GridDiscoveryManager]
class org.apache.ignite.IgniteCheckedException: Remote node has peer class loading enabled flag different from local [locId8=d9ec5b41, locPeerClassLoading=true, rmtId8=3d11ed2e, rmtPeerClassLoading=false, rmtAddrs=[172.17.42.1/0:0:0:0:0:0:0:1%lo, 192.168.57.1/127.0.0.1, 172.16.186.1/172.16.186.1, 01hw191233/172.17.42.1, /192.168.140.54, /192.168.57.1]]
    at org.apache.ignite.internal.managers.discovery.GridDiscoveryManager.checkAttributes(GridDiscoveryManager.java:1082)
    at org.apache.ignite.internal.managers.discovery.GridDiscoveryManager.start(GridDiscoveryManager.java:701)
    at org.apache.ignite.internal.IgniteKernal.startManager(IgniteKernal.java:1571)
    at org.apache.ignite.internal.IgniteKernal.start(IgniteKernal.java:901)
    at org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start0(IgnitionEx.java:1739)
    at org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start(IgnitionEx.java:1589)
    at org.apache.ignite.internal.IgnitionEx.start0(IgnitionEx.java:1042)
    at org.apache.ignite.internal.IgnitionEx.startConfigurations(IgnitionEx.java:964)
    at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:850)
    at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:749)
    at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:619)
    at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:589)
    at org.apache.ignite.Ignition.start(Ignition.java:347)
    at test.main(test.java:61)
[17:23:56,144][SEVERE][main][IgniteKernal] Got exception while starting (will rollback startup routine).
class org.apache.ignite.IgniteCheckedException: Failed to start manager: GridManagerAdapter [enabled=true, name=org.apache.ignite.internal.managers.discovery.GridDiscoveryManager]
    at org.apache.ignite.internal.IgniteKernal.startManager(IgniteKernal.java:1576)
    at org.apache.ignite.internal.IgniteKernal.start(IgniteKernal.java:901)
    at org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start0(IgnitionEx.java:1739)
    at org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start(IgnitionEx.java:1589)
    at org.apache.ignite.internal.IgnitionEx.start0(IgnitionEx.java:1042)
    at org.apache.ignite.internal.IgnitionEx.startConfigurations(IgnitionEx.java:964)
    at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:850)
    at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:749)
    at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:619)
    at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:589)
    at org.apache.ignite.Ignition.start(Ignition.java:347)
    at test.main(test.java:61)
Caused by: class org.apache.ignite.IgniteCheckedException: Remote node has peer class loading enabled flag different from local [locId8=d9ec5b41, locPeerClassLoading=true, rmtId8=3d11ed2e, rmtPeerClassLoading=false, rmtAddrs=[172.17.42.1/0:0:0:0:0:0:0:1%lo, 192.168.57.1/127.0.0.1, 172.16.186.1/172.16.186.1, 01hw191233/172.17.42.1, /192.168.140.54, /192.168.57.1]]
    at org.apache.ignite.internal.managers.discovery.GridDiscoveryManager.checkAttributes(GridDiscoveryManager.java:1082)
    at org.apache.ignite.internal.managers.discovery.GridDiscoveryManager.start(GridDiscoveryManager.java:701)
    at org.apache.ignite.internal.IgniteKernal.startManager(IgniteKernal.java:1571)
    ... 11 more
[17:23:56] Ignite node stopped OK [uptime=00:00:12:167]
Exception in thread "main" class org.apache.ignite.IgniteException: Failed to start manager: GridManagerAdapter [enabled=true, name=org.apache.ignite.internal.managers.discovery.GridDiscoveryManager]
    at org.apache.ignite.internal.util.IgniteUtils.convertException(IgniteUtils.java:908)
    at org.apache.ignite.Ignition.start(Ignition.java:350)
    at test.main(test.java:61)
Caused by: class org.apache.ignite.IgniteCheckedException: Failed to start manager: GridManagerAdapter [enabled=true, name=org.apache.ignite.internal.managers.discovery.GridDiscoveryManager]
    at org.apache.ignite.internal.IgniteKernal.startManager(IgniteKernal.java:1576)
    at org.apache.ignite.internal.IgniteKernal.start(IgniteKernal.java:901)
    at org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start0(IgnitionEx.java:1739)
    at org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start(IgnitionEx.java:1589)
    at org.apache.ignite.internal.IgnitionEx.start0(IgnitionEx.java:1042)
    at org.apache.ignite.internal.IgnitionEx.startConfigurations(IgnitionEx.java:964)
    at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:850)
    at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:749)
    at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:619)
    at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:589)
    at org.apache.ignite.Ignition.start(Ignition.java:347)
    ... 1 more
Caused by: class org.apache.ignite.IgniteCheckedException: Remote node has peer class loading enabled flag different from local [locId8=d9ec5b41, locPeerClassLoading=true, rmtId8=3d11ed2e, rmtPeerClassLoading=false, rmtAddrs=[172.17.42.1/0:0:0:0:0:0:0:1%lo, 192.168.57.1/127.0.0.1, 172.16.186.1/172.16.186.1, 01hw191233/172.17.42.1, /192.168.140.54, /192.168.57.1]]
    at org.apache.ignite.internal.managers.discovery.GridDiscoveryManager.checkAttributes(GridDiscoveryManager.java:1082)
    at org.apache.ignite.internal.managers.discovery.GridDiscoveryManager.start(GridDiscoveryManager.java:701)
    at org.apache.ignite.internal.IgniteKernal.startManager(IgniteKernal.java:1571)
    ... 11 more

查看根本原因:

Remote node has peer class loading enabled flag different from local [locId8=d9ec5b41, locPeerClassLoading=true, rmtId8=3d11ed2e, rmtPeerClassLoading=false
  • ignite.sh 启动一个禁用 peerClassLoading 的节点
  • 您的 Java 代码启动了一个启用了 peerClassLoading 的节点

确保 IgniteConfiguration.peerClassLoading 属性匹配。