I am trying to collocate data based on SQL given in this link
https://ignite.apache.org/features/collocatedprocessing.html .
I have created 2 caches 'Country' and 'City' using following SQLs.
-- Cache Country
CREATE TABLE Country (
Code CHAR(3),
Name CHAR(52),
Continent CHAR(50),
Region CHAR(26),
SurfaceArea DECIMAL(10,2),
Population INT(11),
Capital INT(11),
PRIMARY KEY (Code)) WITH "template=partitioned, backups=1";
--Cache City
CREATE TABLE City (
ID INT(11),
Name CHAR(35),
CountryCode CHAR(3),
District CHAR(20),
Population INT(11),
PRIMARY KEY (ID, CountryCode)
) WITH "template=partitioned, backups=1, affinityKey=CountryCode";
I have inserted some sample records, for example :
insert into Country values('RU','Rusia','Rusia','Rusia',0.0,00,0);
insert into Country values('IND','India','Asia','Asia',0.0,00,0);
insert into City values(101,'Mumbai','IND','NA',00);
insert into City values(102,'Moscow','RU','NA',00);
I have started 2 ignite(on different machines) node to collocate data on
different nodes. After finding records presents on node 0 through visor
cache -scan -c=@c0 -id8=@n0
I can see both cities Mumbai and Moscow are present on node 0 (n0) as well
as on node 1. I was expecting that cities of India will be collocated on
node 0 and cities of Rusia will collocated on node 1 but not both on the
same node.
My questions are :
1. I am doing anything wrong while collocating the data .
2. Running visor cache -scan command is correct way to find collocated data
on nodes ?
3. If this is not correct way then, how can we find which data is collocated
on node 0 and node 1 ?
4. Let's say data is collocated on node 0 (cities of India) and node 1
(cities on Russia) . What will happen if one of the node will be
disconnected from cluster ? Will there be a data loss ? After restarting the
node, Will data be collocated again ?
Thank you in Advance.
PS : I have already asked this question on stack overflow but didn't get
answer
https://stackoverflow.com/questions/55100844/finding-collocated-data-in-ignite
<https://stackoverflow.com/questions/55100844/finding-collocated-data-in-ignite>
I have already tried collocated=true and local=true approaches . I also
tried to remove backups=1 flag from SQL query , starting 3rd node but
nothing is working. Hope I will get answer here :)
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/