You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by joon <an...@gmail.com> on 2016/12/12 20:55:53 UTC

forOldest clustergroup

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.

Re: forOldest clustergroup

Posted by vkulichenko <va...@gmail.com>.
I believe the only workaround is to create your own filter. You can use
ignite.cluster.nodes() to get all nodes  in topology and ClusterNode.order()
to determine node's order. The one with minimal order is the oldest one.

-Val



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

Re: forOldest clustergroup

Posted by joon <an...@gmail.com>.
Ah ok thank you for the quick response, Would there be another method to
implement what I need? My ultimate goal would be to have a fault tolerant
cluster with one node executing jobs. If that node gets disconnected another
node within the cluster will take over and start executing jobs
automatically


vkulichenko wrote
> Hi,
> 
> This is actually a bug: https://issues.apache.org/jira/browse/IGNITE-1403.
> Fixing it requires an incompatible change, so can be done only in 2.0.
> Hopefully, someone will pick it up soon. Feel free to contribute if you're
> interested ;)
> 
> -Val





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

Re: forOldest clustergroup

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

This is actually a bug: https://issues.apache.org/jira/browse/IGNITE-1403.
Fixing it requires an incompatible change, so can be done only in 2.0.
Hopefully, someone will pick it up soon. Feel free to contribute if you're
interested ;)

-Val



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