Apache ignite:禁用对等 class 加载
Apache ignite: Disable peer class loading
我正在尝试从 Spring 引导应用程序连接到 Apache Ignite 服务器。
示例代码:
ClientConfiguration cfg = new ClientConfiguration().setAddresses("127.0.0.1:10800");
try (IgniteClient client = Ignition.startClient(cfg)) {
Object cachedName = client.query(
new SqlFieldsQuery("SELECT name from Person WHERE id=?").setArgs("foo").setSchema("PUBLIC")
).getAll().iterator().next().iterator().next();
}
我收到这个错误:
Caused by: class org.apache.ignite.IgniteCheckedException: Remote node
has peer class loading enabled flag different from local
[locId8=459833a1, locPeerClassLoading=true, rmtId8=83ea88ca,
rmtPeerClassLoading=false,
rmtAddrs=[ignite-0.ignite.default.svc.cluster.local/0:0:0:0:0:0:0:1%lo,
/10.4.2.49, /127.0.0.1], rmtNode=ClusterNode
[id=83ea88ca-da77-4887-9357-267ac7397767, order=1,
addr=[0:0:0:0:0:0:0:1%lo, 10.x.x.x, 127.0.0.1], daemon=false]]
因此需要在我的 Java 代码中停用 PeerClassLoading。我该怎么做?
如评论中所述,错误来自连接到集群的 thick 客户端(或另一台服务器),但代码来自 thin客户。
如果您只是 reading/writing 数据并且不需要执行代码,瘦客户端是一个非常好的选择。
要使用胖客户端,您需要确保胖客户端和服务器具有相同的peer-class加载配置。那将是:
<property name=“peerClassLoadingEnabled” value=“false” />
在您的 Spring 配置文件中。或者:
IgniteConfiguration cfg = new IgniteConfiguration()
...
.setPeerClassLoadingEnabled(false);
(我在这里使用了 false
,因为这是您当前的服务器配置。话虽如此,您可能希望将其打开。)
我正在尝试从 Spring 引导应用程序连接到 Apache Ignite 服务器。
示例代码:
ClientConfiguration cfg = new ClientConfiguration().setAddresses("127.0.0.1:10800");
try (IgniteClient client = Ignition.startClient(cfg)) {
Object cachedName = client.query(
new SqlFieldsQuery("SELECT name from Person WHERE id=?").setArgs("foo").setSchema("PUBLIC")
).getAll().iterator().next().iterator().next();
}
我收到这个错误:
Caused by: class org.apache.ignite.IgniteCheckedException: Remote node has peer class loading enabled flag different from local [locId8=459833a1, locPeerClassLoading=true, rmtId8=83ea88ca, rmtPeerClassLoading=false, rmtAddrs=[ignite-0.ignite.default.svc.cluster.local/0:0:0:0:0:0:0:1%lo, /10.4.2.49, /127.0.0.1], rmtNode=ClusterNode [id=83ea88ca-da77-4887-9357-267ac7397767, order=1, addr=[0:0:0:0:0:0:0:1%lo, 10.x.x.x, 127.0.0.1], daemon=false]]
因此需要在我的 Java 代码中停用 PeerClassLoading。我该怎么做?
如评论中所述,错误来自连接到集群的 thick 客户端(或另一台服务器),但代码来自 thin客户。
如果您只是 reading/writing 数据并且不需要执行代码,瘦客户端是一个非常好的选择。
要使用胖客户端,您需要确保胖客户端和服务器具有相同的peer-class加载配置。那将是:
<property name=“peerClassLoadingEnabled” value=“false” />
在您的 Spring 配置文件中。或者:
IgniteConfiguration cfg = new IgniteConfiguration()
...
.setPeerClassLoadingEnabled(false);
(我在这里使用了 false
,因为这是您当前的服务器配置。话虽如此,您可能希望将其打开。)