ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexey Kukushkin <kukushkinale...@gmail.com>
Subject Re: Ignite caches with separate storage
Date Mon, 18 Dec 2017 15:10:26 GMT
You can use Ignite node attributes to define separate "logical clusters" on
Ignite cluster:

   1. Node attributes are defined in the Ignite configuration as a
   "userAttributes" map. Define an attribute, say, "group":

   <bean class="org.apache.ignite.configuration.IgniteConfiguration">
       <property name="userAttributes">
           <map>
               <entry key=*"**group**" *value="mutable"/>
           </map>
       </property>

   2. Create a GroupNodeFilter:

   public class GroupNodeFilter implements IgnitePredicate<ClusterNode> {

       public GroupNodeFilter(String group) {
           this.group = group;
       }

   /** {@inheritDoc} */
   @Override public boolean apply(ClusterNode node) {
   return group.equals(node.attributes().get(*"**group**"*));
   }
   }


   3. Start caches storing mutable data only where "mutable.processor"
   attribute is defined and cache storing immutable data only where it is
   undefined:

   <bean class="org.apache.ignite.configuration.CacheConfiguration">
       <property name="name" value="c1"/>
       <property name="cacheMode" value="PARTITIONED"/>
       <property name="atomicityMode" value="ATOMIC"/>
       <property name="backups" value="0"/>
       <property name="nodeFilter">

   <bean class=*"**GroupNodeFilter**"*>
       <constructor-arg value="mutable"/></bean>

   </property>
   </bean>

   4. Send compute jobs to corresponding server group:

   IgniteCompute compute =
ignite.compute(ignite.cluster().forAttribute("group", "mutable"));

Mime
View raw message