我们正在使用hazelcast 3.6.3与Jetty 9.4进行会话复制。 hazelcast配置为
Config config = new Config();
config.setInstanceName(HAZELCAST_INSTANCE_NAME);
// logger config
config.setProperty("hazelcast.logging.type", "slf4j");
// config for session map
MapConfig sessionMapConfig = new MapConfig();
sessionMapConfig.setName(SESSION_MAP_NAME)
.setBackupCount(2);
config.addMapConfig(sessionMapConfig);
// peer discovery with zookeeper
config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);
config.setProperty(GroupProperty.DISCOVERY_SPI_ENABLED, "true");
DiscoveryStrategyConfig discoveryStrategyConfig = new DiscoveryStrategyConfig(new ZookeeperDiscoveryStrategyFactory());
discoveryStrategyConfig.addProperty(ZookeeperDiscoveryProperties.ZOOKEEPER_URL.key(), serviceDiscoveryNode);
discoveryStrategyConfig.addProperty(ZookeeperDiscoveryProperties.ZOOKEEPER_PATH.key(), "sessionstore/APP");
discoveryStrategyConfig.addProperty(ZookeeperDiscoveryProperties.GROUP.key(), "cluster-name");
config.getNetworkConfig().getJoin().getDiscoveryConfig().addDiscoveryStrategyConfig(discoveryStrategyConfig);
集群中的一个成员发生故障时,我们会在日志中获取该信息
2018-11-27 13:13:47,217 [WARN ] (1-thread-1) com.hazelcast.map.impl.query.MapQueryEngineImpl - [10.x.x.x]:5702 [dev] [3.6.3] Could not get results
com.hazelcast.core.MemberLeftException: Member [10.x.x.x]:5701 has left cluster!
at com.hazelcast.spi.impl.operationservice.impl.InvocationMonitor$OnMemberLeftTask.run(InvocationMonitor.java:284)
at com.hazelcast.util.executor.CachedExecutorServiceDelegate$Worker.run(CachedExecutorServiceDelegate.java:212)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)
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.spi.impl.operationservice.impl.InvocationFuture.resolveApplicationResponse(InvocationFuture.java:387)
at com.hazelcast.spi.impl.operationservice.impl.InvocationFuture.resolveApplicationResponseOrThrowException(InvocationFuture.java:337)
at com.hazelcast.spi.impl.operationservice.impl.InvocationFuture.get(InvocationFuture.java:225)
at com.hazelcast.spi.impl.operationservice.impl.InvocationFuture.get(InvocationFuture.java:204)
at com.hazelcast.map.impl.query.MapQueryEngineImpl.addResultsOfPredicate(MapQueryEngineImpl.java:528)
at com.hazelcast.map.impl.query.MapQueryEngineImpl.invokeQueryAllPartitions(MapQueryEngineImpl.java:421)
at com.hazelcast.map.impl.proxy.MapProxyImpl.values(MapProxyImpl.java:637)
at com.hazelcast.map.impl.proxy.MapProxyImpl.values(MapProxyImpl.java:625)
at
在会话映射配置中启用分区备份后,为什么会出现异常?
答案 0 :(得分:1)
MemberLeftException
,但是它是RetryableException
,这意味着它将与更新的成员列表一起重试。因此,最终它应该可以自我修复。
OTOH我看到您使用的是3.6.3,但最新的稳定版本是3.11,考虑到此后进行了许多改进和修复,升级是个好主意。