ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From joon <andyjoonp...@gmail.com>
Subject forOldest clustergroup
Date Mon, 12 Dec 2016 20:55:53 GMT
Hi i am currently having problems using the forOldest clustergroup. 

Namely i want to specify a group with one node (oldest in this example) and
execute jobs on it. If it crashes have the group add another node and
execute jobs on that new node. 

currently when i terminate the node that the job is executing on the other
nodes throw a ClustergroupEmptycheckedException. 

This means that when I terminate that node there are no nodes in the
oldestNode group 

Shouldn't the oldestNode group automatically choose the next oldest node and
add that to the group? and then have jobs execute on that node? 

I apologize if this is a trivial question i am rather new to ignite. 
this is my current code. i start three instances of this node and shutdown
the one that the job is running on mid way through the job 



public class StartNode { 

        public static void main(String args[]) { 
                final Ignite ignite =
Ignition.start("Resources/Ignite-config.xml"); 
                IgniteCluster cluster = ignite.cluster(); 
                ClusterGroup oldestNode = cluster.forOldest(); 
                IgniteCompute compute = ignite.compute(oldestNode); 

                compute.broadcast(new IgniteRunnable() { 
                        @Override 
                        public void run() { 
                                // wait for 10 sec 
                                try { 
                                        Thread.sleep(10000); 
                                } catch (InterruptedException e1) { 
                                        // TODO Auto-generated catch block 
                                        e1.printStackTrace(); 
                                } 
                                //signall start of node 
                                System.out.println("started node"); 
                                //wati 30 sec to simulate long running
process 
                                try { 
                                        Thread.sleep(30000); 
                                } catch (InterruptedException e) { 
                                        // TODO Auto-generated catch block 
                                        e.printStackTrace(); 
                                } 
                                //end by printing out the node id it is
runnign on 
                                System.out.println(">>> Hello Node: " 
                                                +
ignite.cluster().localNode().id()); 
                        } 
                }); 
        } 

} 

from : http://apacheignite.gridgain.org/docs/cluster-groups

IgniteCluster cluster = ignite.cluster();

// Dynamic cluster group representing the oldest cluster node.
// Will automatically shift to the next oldest, if the oldest
// node crashes.
ClusterGroup oldestNode = cluster.forOldest();



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/forOldest-clustergroup-tp9487.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Mime
View raw message