You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Olexandr K <ol...@gmail.com> on 2018/03/06 09:42:25 UTC

How to configure write through persistence?

Hi Team,

I'm trying to configure persistent cache.

Specifically I need to cache key-value pairs and they should be also stored
to persistent storage.

Here is my configuration:

[ignite.xml]
...
<property name="cacheConfiguration">
            <list>
                <bean
class="org.apache.ignite.configuration.CacheConfiguration">
                    <property name="name" value="Session"/>
                    <property name="atomicityMode" value="TRANSACTIONAL"/>
                    <property name="writeSynchronizationMode"
value="FULL_SYNC"/>
                    <property name="cacheMode" value="PARTITIONED"/>
                    <property name="backups" value="0"/>
                </bean>
            </list>
        </property>

        <property name="dataStorageConfiguration">
            <bean
class="org.apache.ignite.configuration.DataStorageConfiguration">
                <property name="defaultDataRegionConfiguration">
                    <bean
class="org.apache.ignite.configuration.DataRegionConfiguration">
                        <property name="persistenceEnabled" value="true"/>
                    </bean>
                </property>
            </bean>
        </property>

Here is my client code:

Ignition.setClientMode(true);
ignite = Ignition.start("classpath:///ignite.xml");
ignite.active(true);
...
ignite.getSessionCache().put(key, value);

I cannot get my data back after bouncing Ignite node.
What I'm missing here?

BR, Oleksandr

Re: How to configure write through persistence?

Posted by Olexandr K <ol...@gmail.com>.
Thanks Dmitry

I started server node via bin/ignite.sh but didn't override DEFAULT_CONFIG
to point on my configuration

As result, client node was using my config and server node used default
config.

Persistence is working after fixing this.


On Tue, Mar 6, 2018 at 11:55 AM, Dmitry Pavlov <dp...@gmail.com>
wrote:

> Hi Oleksandr,
>
> Could you please check Ignite logs for messages were persistence directory
> located?
>
> When Ignite is started from code, it is possible that Ignite is not able
> to locate IGNITE_WORK or IGNITE_HOME and creates work files in temp dir.
> Start scripts always provide this setting, but in developer's environment
> it may be missed.
>
> Setting up work/home/persistenceStoreDir will probably help to locate data
> files in configured place, so inserted data will be loaded always.
>
> Sincerely,
> Dmitriy Pavlov
>
> вт, 6 мар. 2018 г. в 12:42, Olexandr K <ol...@gmail.com>:
>
>> Hi Team,
>>
>> I'm trying to configure persistent cache.
>>
>> Specifically I need to cache key-value pairs and they should be also
>> stored to persistent storage.
>>
>> Here is my configuration:
>>
>> [ignite.xml]
>> ...
>> <property name="cacheConfiguration">
>>             <list>
>>                 <bean class="org.apache.ignite.configuration.
>> CacheConfiguration">
>>                     <property name="name" value="Session"/>
>>                     <property name="atomicityMode" value="TRANSACTIONAL"/>
>>                     <property name="writeSynchronizationMode"
>> value="FULL_SYNC"/>
>>                     <property name="cacheMode" value="PARTITIONED"/>
>>                     <property name="backups" value="0"/>
>>                 </bean>
>>             </list>
>>         </property>
>>
>>         <property name="dataStorageConfiguration">
>>             <bean class="org.apache.ignite.configuration.
>> DataStorageConfiguration">
>>                 <property name="defaultDataRegionConfiguration">
>>                     <bean class="org.apache.ignite.configuration.
>> DataRegionConfiguration">
>>                         <property name="persistenceEnabled" value="true"/>
>>                     </bean>
>>                 </property>
>>             </bean>
>>         </property>
>>
>> Here is my client code:
>>
>> Ignition.setClientMode(true);
>> ignite = Ignition.start("classpath:///ignite.xml");
>> ignite.active(true);
>> ...
>> ignite.getSessionCache().put(key, value);
>>
>> I cannot get my data back after bouncing Ignite node.
>> What I'm missing here?
>>
>> BR, Oleksandr
>>
>

Re: How to configure write through persistence?

Posted by Dmitry Pavlov <dp...@gmail.com>.
Hi Oleksandr,

Could you please check Ignite logs for messages were persistence directory
located?

When Ignite is started from code, it is possible that Ignite is not able to
locate IGNITE_WORK or IGNITE_HOME and creates work files in temp dir. Start
scripts always provide this setting, but in developer's environment it may
be missed.

Setting up work/home/persistenceStoreDir will probably help to locate data
files in configured place, so inserted data will be loaded always.

Sincerely,
Dmitriy Pavlov

вт, 6 мар. 2018 г. в 12:42, Olexandr K <ol...@gmail.com>:

> Hi Team,
>
> I'm trying to configure persistent cache.
>
> Specifically I need to cache key-value pairs and they should be also
> stored to persistent storage.
>
> Here is my configuration:
>
> [ignite.xml]
> ...
> <property name="cacheConfiguration">
>             <list>
>                 <bean
> class="org.apache.ignite.configuration.CacheConfiguration">
>                     <property name="name" value="Session"/>
>                     <property name="atomicityMode" value="TRANSACTIONAL"/>
>                     <property name="writeSynchronizationMode"
> value="FULL_SYNC"/>
>                     <property name="cacheMode" value="PARTITIONED"/>
>                     <property name="backups" value="0"/>
>                 </bean>
>             </list>
>         </property>
>
>         <property name="dataStorageConfiguration">
>             <bean
> class="org.apache.ignite.configuration.DataStorageConfiguration">
>                 <property name="defaultDataRegionConfiguration">
>                     <bean
> class="org.apache.ignite.configuration.DataRegionConfiguration">
>                         <property name="persistenceEnabled" value="true"/>
>                     </bean>
>                 </property>
>             </bean>
>         </property>
>
> Here is my client code:
>
> Ignition.setClientMode(true);
> ignite = Ignition.start("classpath:///ignite.xml");
> ignite.active(true);
> ...
> ignite.getSessionCache().put(key, value);
>
> I cannot get my data back after bouncing Ignite node.
> What I'm missing here?
>
> BR, Oleksandr
>