我正在尝试使用客户端服务器模式评估Apache Ignite . 我有使用Hazelcast和Infinispan的一些经验,所以我来自IMDG背景 .
我在客户端 - 服务器模式下使用Ignite的初步经验并不是很顺利 . 我可能听起来很自以为是,但我觉得大多数高级用例都适用于嵌入式服务器模式 .
题:
我确实有很多,但我正在发布我现在面临的那个 . 我使用的是v2.1.0 . 我正在尝试利用Ignite的 durable memory 功能 . 所以我在服务器配置中打开了持久性,如文档中所述 .
现在,当我尝试从客户端连接代码时
Ignition.setClientMode(true);
IgniteConfiguration cfg = new IgniteConfiguration();
//cfg.setPeerClassLoadingEnabled(true);
TcpCommunicationSpi commSpi = new TcpCommunicationSpi();
commSpi.setSlowClientQueueLimit(1000);
TcpDiscoverySpi discoverySpi = new TcpDiscoverySpi();
TcpDiscoveryVmIpFinder ipfinder = new TcpDiscoveryVmIpFinder();
ipfinder.setAddresses(Arrays.asList("localhost"));
discoverySpi.setIpFinder(ipfinder);
cfg.setCommunicationSpi(commSpi);
cfg.setDiscoverySpi(discoverySpi);
ignite = Ignition.start(cfg);
//ignite.active(true);
CacheConfiguration config = new CacheConfiguration<>("Person");
config.setCacheMode(CacheMode.PARTITIONED);
//config.setOnheapCacheEnabled(true);
//config.setEvictionPolicy(new LruEvictionPolicy<>(2));
ignite.getOrCreateCache(config);
我得到以下异常:
class org.apache.ignite.IgniteException: Can not perform the operation because the cluster is inactive. Note, that the cluster is considered inactive by default if Ignite Persistent Store is used to let all the nodes join the cluster. To activate the cluster call Ignite.activate(true).
at org.apache.ignite.internal.IgniteKernal.checkClusterState(IgniteKernal.java:3712)
at org.apache.ignite.internal.IgniteKernal.getOrCreateCache0(IgniteKernal.java:2837)
at org.apache.ignite.internal.IgniteKernal.getOrCreateCache(IgniteKernal.java:2824)
如果我设置 ignite.activate(true) ,代码挂起(阻塞?等待?) . 为什么我的客户端(我假设)不作为数据节点参与,需要表现为一个?我在这里错过了什么吗?任何帮助,将不胜感激 .
这是我在服务器上看到的例外 .
[13:54:52] Topology snapshot [ver=5, servers=1, clients=0, CPUs=4, heap=0.13GB]
[14:02:19] Topology snapshot [ver=6, servers=1, clients=1, CPUs=4, heap=1.9GB]
[14:02:20] Default checkpoint page buffer size is too small, setting to an adjusted value: 1.6 GiB
[14:02:20,446][SEVERE][exchange-worker-#34%null%][GridDhtPartitionsExchangeFuture] Failed to reinitialize local partitions (preloading will be stopped
): GridDhtPartitionExchangeId [topVer=AffinityTopologyVersion [topVer=6, minorTopVer=1], nodeId=bccb36d2, evt=DISCOVERY_CUSTOM_EVT]
java.lang.OutOfMemoryError
at sun.misc.Unsafe.allocateMemory(Native Method)
at org.apache.ignite.internal.util.GridUnsafe.allocateMemory(GridUnsafe.java:1054)
at org.apache.ignite.internal.mem.unsafe.UnsafeMemoryProvider.nextRegion(UnsafeMemoryProvider.java:80)
at org.apache.ignite.internal.processors.cache.persistence.pagemem.PageMemoryImpl.start(PageMemoryImpl.java:276)
at org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager.startMemoryPolicies(IgniteCacheDatabaseSharedManag
er.java:194)
at org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager.onActivate(IgniteCacheDatabaseSharedManager.java:9
49)
at org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager.onActivate(GridCacheDatabaseSharedManager.java:459)
at org.apache.ignite.internal.processors.cache.GridCacheSharedContext.activate(GridCacheSharedContext.java:244)
at org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture.onClusterStateChangeRequest(GridDhtPa
rtitionsExchangeFuture.java:762)
at org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture.init(GridDhtPartitionsExchangeFuture.
java:574)
at org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$ExchangeWorker.body(GridCachePartitionExchangeManager.java:19
01)
at org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:110)
at java.lang.Thread.run(Thread.java:745)
[14:02:20,478][SEVERE][exchange-worker-#34%null%][GridCachePartitionExchangeManager] Runtime error caught during grid runnable execution: GridWorker [
name=partition-exchanger, igniteInstanceName=null, finished=false, hashCode=1380507612, interrupted=false, runner=exchange-worker-#34%null%]
java.lang.OutOfMemoryError
at sun.misc.Unsafe.allocateMemory(Native Method)
at org.apache.ignite.internal.util.GridUnsafe.allocateMemory(GridUnsafe.java:1054)
at org.apache.ignite.internal.mem.unsafe.UnsafeMemoryProvider.nextRegion(UnsafeMemoryProvider.java:80)
at org.apache.ignite.internal.processors.cache.persistence.pagemem.PageMemoryImpl.start(PageMemoryImpl.java:276)
at org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager.startMemoryPolicies(IgniteCacheDatabaseSharedManag
er.java:194)
at org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager.onActivate(IgniteCacheDatabaseSharedManager.java:9
49)
at org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager.onActivate(GridCacheDatabaseSharedManager.java:459)
at org.apache.ignite.internal.processors.cache.GridCacheSharedContext.activate(GridCacheSharedContext.java:244)
at org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture.onClusterStateChangeRequest(GridDhtPa
rtitionsExchangeFuture.java:762)
at org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture.init(GridDhtPartitionsExchangeFuture.
java:574)
at org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$ExchangeWorker.body(GridCachePartitionExchangeManager.java:19
01)
at org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:110)
at java.lang.Thread.run(Thread.java:745)
Exception in thread "exchange-worker-#34%null%" java.lang.OutOfMemoryError
at sun.misc.Unsafe.allocateMemory(Native Method)
at org.apache.ignite.internal.util.GridUnsafe.allocateMemory(GridUnsafe.java:1054)
at org.apache.ignite.internal.mem.unsafe.UnsafeMemoryProvider.nextRegion(UnsafeMemoryProvider.java:80)
at org.apache.ignite.internal.processors.cache.persistence.pagemem.PageMemoryImpl.start(PageMemoryImpl.java:276)
at org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager.startMemoryPolicies(IgniteCacheDatabaseSharedManag
er.java:194)
at org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager.onActivate(IgniteCacheDatabaseSharedManager.java:9
49)
at org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager.onActivate(GridCacheDatabaseSharedManager.java:459)
at org.apache.ignite.internal.processors.cache.GridCacheSharedContext.activate(GridCacheSharedContext.java:244)
at org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture.onClusterStateChangeRequest(GridDhtPa
rtitionsExchangeFuture.java:762)
at org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture.init(GridDhtPartitionsExchangeFuture.
java:574)
at org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$ExchangeWorker.body(GridCachePartitionExchangeManager.java:19
01)
at org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:110)
at java.lang.Thread.run(Thread.java:745)
[14:02:20,846][SEVERE][query-#174%null%][msg] Received message without registered handler (will ignore) [msg=GridCacheQueryRequest [id=3, cacheName=ig
nite-sys-cache, type=SCAN, fields=false, clause=null, clsName=null, keyValFilter=null, rdc=null, trans=null, pageSize=1024, incBackups=false, cancel=f
alse, incMeta=false, all=false, keepBinary=false, subjId=61cfa42e-40af-473d-a9f6-2fe249d66910, taskHash=0, part=-1, topVer=AffinityTopologyVersion [to
pVer=6, minorTopVer=1], super=GridCacheIdMessage [cacheId=-2100569601]], node=61cfa42e-40af-473d-a9f6-2fe249d66910, locTopVer=AffinityTopologyVersion
[topVer=-1, minorTopVer=0], msgTopVer=AffinityTopologyVersion [topVer=6, minorTopVer=1], desc=DynamicCacheDescriptor [deploymentId=4093bcfdd51-bae6026
e-62b0-4189-854b-9efa4b8bf23f, staticCfg=true, sql=false, cacheType=UTILITY, template=false, updatesAllowed=true, cacheId=-2100569601, rcvdFrom=bccb36
d2-2c8f-4642-b84d-63b5dd2ab93b, objCtx=null, rcvdOnDiscovery=false, startTopVer=AffinityTopologyVersion [topVer=6, minorTopVer=0], rcvdFromVer=Affinit
yTopologyVersion [topVer=1, minorTopVer=0], clientCacheStartVer=null, schema=QuerySchema [], grpDesc=CacheGroupDescriptor [grpId=-2100569601, grpName=
null, startTopVer=null, rcvdFrom=bccb36d2-2c8f-4642-b84d-63b5dd2ab93b, deploymentId=4093bcfdd51-bae6026e-62b0-4189-854b-9efa4b8bf23f, caches={ignite-s
ys-cache=-2100569601}, rcvdFromVer=AffinityTopologyVersion [topVer=1, minorTopVer=0], cacheName=ignite-sys-cache], cacheName=ignite-sys-cache]]
Registered listeners: