You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Aiden <19...@gmail.com> on 2017/07/06 12:08:57 UTC

Loading similar data to specific instance and not all instances

So i'm really new to apache ignite here. What i'm trying to do is load data
having similar properties to a single rather than it being loaded to random
instances. For example, say that some data of this form:

    ROLL_NO
    34569
    12349
    34439
    45329
    32359
    43549
    53259
    34229

As u can see, the above data is all ending with 9. Say that i have two
ignite instances A and B currently running. **Is there any way i can load
these data ending with 9 to either of the instance A or B and NOT BOTH.**

Please let me know if this is possible and if so how to accomplish this.
Thanks in advance.



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Loading-similar-data-to-specific-instance-and-not-all-instances-tp14387.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Loading similar data to specific instance and not all instances

Posted by vkulichenko <va...@gmail.com>.
Hi Aiden,

Technically this should be done as I already described on SO [1]. You will
need to remodel the data so that the portion of data used for collocation is
represented as a separate field, this field has to be part of key object and
configured as affinity key.

[1]
https://stackoverflow.com/questions/44948442/ignite-loading-similar-data-to-particular-instance

-Val



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Loading-similar-data-to-specific-instance-and-not-all-instances-tp14387p14608.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Loading similar data to specific instance and not all instances

Posted by Aiden <19...@gmail.com>.
Hello,

The use-case is simply this: I'm trying to load data having similar
properties, in my case, records ending with same number, say 0, into a
single instance of ignite and not multiple instances. 

Basically, if similar data is stored in a specific instance, then when i'm
trying to query for that record, the query fetching time will be greatly
reduced.  

Let me give an example, say if following records are present:

 ROLL_NO
    34560
    12340
    34439
    45321
    32359
    43541
    53250
    34220

Say there are 3 instances A,B,C:

For instance, ALL Records ending with 0 should be loaded to either A or B or
C(irrespective). But not like 1 record ending with 0 in A another in B in
that manner. I believe this can be done using AffinityKeyMapping????

Thanks,
Aiden 




--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Loading-similar-data-to-specific-instance-and-not-all-instances-tp14387p14543.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Loading similar data to specific instance and not all instances

Posted by vkulichenko <va...@gmail.com>.
Hi,

Can you please tell what is a business use case behind this? What exactly
are you trying to achieve with Ignite?

-Val



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Loading-similar-data-to-specific-instance-and-not-all-instances-tp14387p14502.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Loading similar data to specific instance and not all instances

Posted by Aiden <19...@gmail.com>.
Hello all,

I'm totally a newbie here, so just bear with me. I followed through this
link:
https://github.com/apache/ignite/blob/master/modules/core/src/main/java/org/apache/ignite/cache/affinity/AffinityKeyMapper.java
<https://github.com/apache/ignite/blob/master/modules/core/src/main/java/org/apache/ignite/cache/affinity/AffinityKeyMapper.java>  

I tried to apply the same procedure as prescribed. Unfortunately due to some
error from my side i'm just not able to create this affinity key mapping.

I'm forwarding my BEAN Class and my server.xml(generated using ignite web
console).

Persons.java
<http://apache-ignite-users.70518.x6.nabble.com/file/n14471/Persons.java>  
RemoteIgniteCluster-server.xml
<http://apache-ignite-users.70518.x6.nabble.com/file/n14471/RemoteIgniteCluster-server.xml>  

Age
*****
50
60
70
80
90
100
10
20
30
40
110


As u can see, Age is 1 column in the database table that i'm trying to load
to the ignite cache partition. Every value in Age ends with 0. I have two
ignite instances A, B. When i'm loading the above table to ignite partition.
It should have to load to either A or B completely and NOT BOTH. 

I understand for this, AffinityKeyMapper can be used. But i'm not being able
to understand in what way. 

Can somebody please take time to tell me what all changes i have to do in my
in my bean class and my server.xml to bring about this change. I'd
appreciate it a lot.

Thanks in advance..



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Loading-similar-data-to-specific-instance-and-not-all-instances-tp14387p14471.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Loading similar data to specific instance and not all instances

Posted by Michael Cherkasov <mi...@gmail.com>.
Hi Aiden,

You need to set an AffinityKeyMapper for your cache. Read javadoc for
details:

https://github.com/apache/ignite/blob/master/modules/core/src/main/java/org/apache/ignite/cache/affinity/AffinityKeyMapper.java

Thanks,
Mikhail.

2017-07-06 15:08 GMT+03:00 Aiden <19...@gmail.com>:

> So i'm really new to apache ignite here. What i'm trying to do is load data
> having similar properties to a single rather than it being loaded to random
> instances. For example, say that some data of this form:
>
>     ROLL_NO
>     34569
>     12349
>     34439
>     45329
>     32359
>     43549
>     53259
>     34229
>
> As u can see, the above data is all ending with 9. Say that i have two
> ignite instances A and B currently running. **Is there any way i can load
> these data ending with 9 to either of the instance A or B and NOT BOTH.**
>
> Please let me know if this is possible and if so how to accomplish this.
> Thanks in advance.
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Loading-similar-data-to-specific-instance-and-not-all-
> instances-tp14387.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>