服务器重启时 Hazelcast 客户端重新连接时出错
Error on Hazelcast client reconnect on server restart
当唯一的 hazelcast 服务器节点重新启动时,我在 hazelcast 客户端重新连接时遇到异常:
SEVERE: Error while fetching cluster partition table!
com.hazelcast.core.HazelcastInstanceNotActiveException: Hazelcast instance is not ready yet!
at com.hazelcast.client.impl.ClientEngineImpl$ClientPacketProcessor.processRequest(ClientEngineImpl.java:423)
at com.hazelcast.client.impl.ClientEngineImpl$ClientPacketProcessor.run(ClientEngineImpl.java:346)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
at com.hazelcast.util.executor.HazelcastManagedThread.executeRun(HazelcastManagedThread.java:76)
at com.hazelcast.util.executor.HazelcastManagedThread.run(HazelcastManagedThread.java:92)
at ------ End remote and begin local stack-trace ------.(Unknown Source)
at com.hazelcast.client.connection.nio.ClientConnectionManagerImpl.sendAndReceive(ClientConnectionManagerImpl.java:500)
at com.hazelcast.client.connection.nio.ClientConnectionManagerImpl.authenticate(ClientConnectionManagerImpl.java:474)
at com.hazelcast.client.connection.nio.ClientConnectionManagerImpl.access00(ClientConnectionManagerImpl.java:85)
at com.hazelcast.client.connection.nio.ClientConnectionManagerImpl$ClusterAuthenticator.auth(ClientConnectionManagerImpl.java:461)
at com.hazelcast.client.connection.nio.ClientConnectionManagerImpl$ConnectionProcessor.call(ClientConnectionManagerImpl.java:395)
at com.hazelcast.client.connection.nio.ClientConnectionManagerImpl$ConnectionProcessor.call(ClientConnectionManagerImpl.java:353)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at com.hazelcast.util.executor.CompletableFutureTask.run(CompletableFutureTask.java:57)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
at com.hazelcast.util.executor.HazelcastManagedThread.executeRun(HazelcastManagedThread.java:76)
at com.hazelcast.util.executor.HazelcastManagedThread.run(HazelcastManagedThread.java:92)
这不会阻止客户端重新连接,客户端会在几秒钟后重新连接:
INFO: HazelcastClient[hz.client_0_dev][3.4.2] is CLIENT_CONNECTED
知道发生了什么以及如何防止此日志出现吗?
我在本地 运行 服务器和客户端。
服务器配置:
private static Config createServerConfig(int port, String members) {
Config config = new Config();
NetworkConfig network = config.getNetworkConfig();
network.setPort(port);
network.setPortAutoIncrement(true);
JoinConfig join = network.getJoin();
join.getMulticastConfig().setEnabled(false);
join.getTcpIpConfig().setEnabled(true);
for (String host : members.split(";")) {
join.getTcpIpConfig().addMember(host);
}
return config;
}
客户端配置:
private static ClientConfig createClientConfig(String members) {
ClientConfig config = new ClientConfig();
ClientNetworkConfig cnc = new ClientNetworkConfig();
cnc.setConnectionAttemptLimit(0);
for (String host : members.split(";")) {
cnc.addAddress(host);
}
config.setNetworkConfig(cnc);
return config;
}
这不是破坏性异常。分区 Table 会定期更新,无法更新分区 table 不会影响一致性。唯一的问题是集群更改后短时间内的性能。
不幸的是,没有办法阻止这种情况的发生。就我们而言,似乎将其打印为 SEVERE 日志从一开始就是错误的。如果您在 https://github.com/hazelcast/ 提交问题,您可以跟踪相关修复的过程。
当唯一的 hazelcast 服务器节点重新启动时,我在 hazelcast 客户端重新连接时遇到异常:
SEVERE: Error while fetching cluster partition table!
com.hazelcast.core.HazelcastInstanceNotActiveException: Hazelcast instance is not ready yet!
at com.hazelcast.client.impl.ClientEngineImpl$ClientPacketProcessor.processRequest(ClientEngineImpl.java:423)
at com.hazelcast.client.impl.ClientEngineImpl$ClientPacketProcessor.run(ClientEngineImpl.java:346)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
at com.hazelcast.util.executor.HazelcastManagedThread.executeRun(HazelcastManagedThread.java:76)
at com.hazelcast.util.executor.HazelcastManagedThread.run(HazelcastManagedThread.java:92)
at ------ End remote and begin local stack-trace ------.(Unknown Source)
at com.hazelcast.client.connection.nio.ClientConnectionManagerImpl.sendAndReceive(ClientConnectionManagerImpl.java:500)
at com.hazelcast.client.connection.nio.ClientConnectionManagerImpl.authenticate(ClientConnectionManagerImpl.java:474)
at com.hazelcast.client.connection.nio.ClientConnectionManagerImpl.access00(ClientConnectionManagerImpl.java:85)
at com.hazelcast.client.connection.nio.ClientConnectionManagerImpl$ClusterAuthenticator.auth(ClientConnectionManagerImpl.java:461)
at com.hazelcast.client.connection.nio.ClientConnectionManagerImpl$ConnectionProcessor.call(ClientConnectionManagerImpl.java:395)
at com.hazelcast.client.connection.nio.ClientConnectionManagerImpl$ConnectionProcessor.call(ClientConnectionManagerImpl.java:353)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at com.hazelcast.util.executor.CompletableFutureTask.run(CompletableFutureTask.java:57)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
at com.hazelcast.util.executor.HazelcastManagedThread.executeRun(HazelcastManagedThread.java:76)
at com.hazelcast.util.executor.HazelcastManagedThread.run(HazelcastManagedThread.java:92)
这不会阻止客户端重新连接,客户端会在几秒钟后重新连接:
INFO: HazelcastClient[hz.client_0_dev][3.4.2] is CLIENT_CONNECTED
知道发生了什么以及如何防止此日志出现吗?
我在本地 运行 服务器和客户端。
服务器配置:
private static Config createServerConfig(int port, String members) {
Config config = new Config();
NetworkConfig network = config.getNetworkConfig();
network.setPort(port);
network.setPortAutoIncrement(true);
JoinConfig join = network.getJoin();
join.getMulticastConfig().setEnabled(false);
join.getTcpIpConfig().setEnabled(true);
for (String host : members.split(";")) {
join.getTcpIpConfig().addMember(host);
}
return config;
}
客户端配置:
private static ClientConfig createClientConfig(String members) {
ClientConfig config = new ClientConfig();
ClientNetworkConfig cnc = new ClientNetworkConfig();
cnc.setConnectionAttemptLimit(0);
for (String host : members.split(";")) {
cnc.addAddress(host);
}
config.setNetworkConfig(cnc);
return config;
}
这不是破坏性异常。分区 Table 会定期更新,无法更新分区 table 不会影响一致性。唯一的问题是集群更改后短时间内的性能。
不幸的是,没有办法阻止这种情况的发生。就我们而言,似乎将其打印为 SEVERE 日志从一开始就是错误的。如果您在 https://github.com/hazelcast/ 提交问题,您可以跟踪相关修复的过程。