ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vladislav Pyatkov <vldpyat...@gmail.com>
Subject Re: How to save odd number objects on one node and even number objects on another node
Date Fri, 16 Dec 2016 13:47:07 GMT
I think, simplest AffinityKeyMapper[1] will be sufficient:

public Object affinityKey(Object key) {
        if (key instanceof Integer)
            return ((Integer)key) % 2;
}

and configuration like this:

<bean id="deposit-template" abstract="true"
class="org.apache.ignite.configuration.CacheConfiguration">
       <property name="affinityMapper">
           <bean class="my.affinity.mapper.AffinityMapperImpl"/>
       </property>
...

[1]: org.apache.ignite.cache.affinity.AffinityKeyMapper

On Fri, Dec 16, 2016 at 12:34 AM, rishireddy.bokka <
rishireddy.bokka@gmail.com> wrote:

> Hi Ignite Team,
> I recently started using Ignite and seems very useful.
> I am having 2 nodes(n1, n2) and I have like 100,000 objects (say Person
> object)with keys as integers starting from 1 till 100,000 that should be
> saved on both nodes.
> I want 1,3,5,7,9....... person objects to be saved on node n1 and
> 2,4,6,8,........ person objects to be saved on node n2.
> Is it possible to achieve this using partitioned cache mode? If yes could
> you please let me know how?
>
> Thanks,
> Rishi
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/How-to-save-odd-number-objects-on-
> one-node-and-even-number-objects-on-another-node-tp9572.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>



-- 
Vladislav Pyatkov

Mime
View raw message