2017-08-14 100 views
1

我正在嘗試使用客戶端服務器模式評估Apache Ignite。我有一些使用Hazelcast和Infinispan的經驗,所以我來自IMDG背景。在客戶端 - 服務器模式下使用Apache Ignite

我在客戶端 - 服務器模式下使用Ignite的最初經驗並不十分流暢。我聽起來很有見地,但我認爲大多數高級用例都適合從嵌入式服務器模式的角度來看。

問:

我也有很多,但我出版這是我現在所面臨現在的一個。我正在使用v2.1.0。我正在嘗試利用Ignite的durable memory功能。所以我已經打開了我的服務器配置中的持久性,如文檔中所述。

<property name="persistentStoreConfiguration"> 
    <bean class="org.apache.ignite.configuration.PersistentStoreConfiguration"/> 
</property> 

現在,當我嘗試從一個客戶端連接,用代碼

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<String, Person> 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: 
+0

請充分分享日誌和線程轉儲節點 –

+0

@EvgeniiZhuravlev我已經添加了服務器日誌。我有一個服務器節點。還有一點,我以128米的最小/最大堆量啓動了服務器。 –

回答

1

拓撲快照[版本= 5,服務器= 1,客戶端= 0,CPU的= 4,堆= 0.13GB]

你已經開始Ignite服務器節點有過小堆內存(128MB),嘗試增加它(參數-Xmx & -Xms)。

此外,默認情況下,Ignite嘗試爲計算機的所有物理內存分配0.8的pageMemory。因此,如果您想在同一臺計算機上啓動多個節點,則需要爲節點配置MemoryPolicy。

檢查這個documentation更多的信息和示例

+0

即使我用默認的1G啓動它,仍然會得到相同的異常。 '[14:11:55]點火節點開始OK(id = beaa3252) [14:11:55]拓撲快照[ver = 1,servers = 1,clients = 0,CPUs = 4,堆= 1.0GB] [14:12:19]拓撲快照[版本= 2,服務器= 1,客戶端= 1,CPU = 4,堆= 2.8GB] [14:12:20]默認檢查點頁面緩衝區大小太小,設置爲調整值:1.6吉布 ' –

+0

這是JVM ARGS我使用,'ignite.bat -J-Xms128m -J-Xmx512m -J-XX:MaxDirectMemorySize = 512m' –

+0

添加信息來回答 –

相關問題