2017-06-29 168 views
0

以下是缓存的配置。我希望writeThrough被启用。为什么我得到了下面的异常? “作家或商店不提供”是什么意思?org.apache.ignite.IgniteCheckedException:无法启用直写

配置:

<property name="cacheConfiguration"> 
    <bean class="org.apache.ignite.configuration.CacheConfiguration"> 
     <property name="name" value="txnCache"/> 
     <property name="cacheMode" value="PARTITIONED"/> 
     <property name="writeSynchronizationMode" value="FULL_SYNC"/> 
     <property name="writeThrough" value="true"/> 
     <property name="backups" value="1"/> 
    <!--property name="cacheMode" value="REPLICATED"/--> 
    <!-- <property name="atomicityMode" value="ATOMIC"/> 
    <property name="readFromBackup" value="true"/> 
    <property name="copyOnRead" value="true"/>--> 
    </bean> 
</property> 

错误:

[13:24:07,176][SEVERE][main][IgniteKernal] Got exception while starting (will rollback startup routine). 
class org.apache.ignite.IgniteCheckedException: Cannot enable write-through (writer or store is not provided) for cache: txnCache 
     at org.apache.ignite.internal.processors.cache.GridCacheProcessor.validate(GridCacheProcessor.java:482) 
     at org.apache.ignite.internal.processors.cache.GridCacheProcessor.createCache(GridCacheProcessor.java:1462) 
     at org.apache.ignite.internal.processors.cache.GridCacheProcessor.onKernalStart(GridCacheProcessor.java:885) 
     at org.apache.ignite.internal.IgniteKernal.start(IgniteKernal.java:1013) 
     at org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start0(IgnitionEx.java:1895) 
     at org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start(IgnitionEx.java:1647) 
     at org.apache.ignite.internal.IgnitionEx.start0(IgnitionEx.java:1075) 
     at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:573) 
     at org.apache.ignite.internal.processors.platform.PlatformAbstractBootstrap.start(PlatformAbstractBootstrap.java:48) 
     at org.apache.ignite.internal.processors.platform.PlatformIgnition.start(PlatformIgnition.java:76) 
[13:24:07] Cancelled rebalancing from all nodes [topology=null] 
[13:24:07] Cancelled rebalancing from all nodes [topology=null] 

回答

3

要,你需要实现CacheStore接口配置直写(或使用现有的一个),并设置cacheStoreFactory以及直写属性CacheConfiguration的外观如下:

<bean id= "simpleDataSource" class="org.h2.jdbcx.JdbcDataSource"/> 

<bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration"> 
    ... 
    <property name="cacheConfiguration"> 
     <list> 
     <bean class="org.apache.ignite.configuration.CacheConfiguration"> 
      ... 
      <property name="writeThrough" value="true"/> 
      <property name="cacheStoreFactory"> 
       <bean class="org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory"> 
       <property name="dataSourceBean" value = "simpleDataSource" /> 
       </bean> 
      </property> 
     </bean> 
     </list> 
    </property> 
</bean> 

这里是关于cacheStore和直写的更多信息:

https://apacheignite.readme.io/v2.0/docs/persistent-store#section-read-through-and-write-through

what does "writer or store is not provided" mean?

这意味着你没有在配置中提供存储。