Search code examples
ignite

Apache ignite node data loss recovery on node restart


Here,s the problem .

I started 6 ignite server nodes, loads the cache in them. queried using "dbeaver" it shows complete data in nodes. Now I shutdown one node . Queried by dbever, it shows less data. Now the same node I started again but data is still less.

How to resolve this ? I dont want to lose data when a node goes down. And if node is restarted then how to get the missing data.

I am loading cache from MySql db .


Solution

  • You don't give very much information about your cluster, so I'm guess that you're entirely in-memory and you're using the defaults for cache creation.

    The default cache is partitioned (i.e., sharded), which is why you lose data when you shut down a node. You can, however, have backups.

    <bean class="org.apache.ignite.configuration.IgniteConfiguration">
    ...
    <property name="cacheConfiguration">
        <bean class="org.apache.ignite.configuration.CacheConfiguration">
            <!-- Set a cache name. -->
            <property name="name" value="cacheName"/>
            <!-- Set cache mode. -->
            <property name="cacheMode" value="PARTITIONED"/>
            <!-- Number of backup nodes. -->
            <property name="backups" value="1"/>
            ... 
        </bean>
    </property>
    </bean> 
    

    You can also change how Ignite behaves if you lose part of a cache with the partition loss policy.