Hi Kamal, You can do this manually because by default a service method will be executed on random node from a cluster group (at least this works this way when you talk to a service through service proxy).
To implement your scenario you need to track ClusterMetrics of the cluster nodes and pick up a node with minimal CPU load using for service related operations - Ignition.ignite().services(nodeWithSmallCPUUsage). — Denis > On Jul 11, 2016, at 2:16 PM, Kamal C <[email protected]> wrote: > > When a node which provides the service have high CPU and heap memory usage. > Can I switch the service from that node to the other eligible node ? > > On Mon, Jul 11, 2016 at 4:40 PM, Vladislav Pyatkov <[email protected] > <mailto:[email protected]>> wrote: > Hello Kamal, > > - How to tell Ignite to move a clustered singleton service from one node to > another with external scripts? > > What are you mean when say: "move a clustered singleton service from one node > to another"? If singleton service was deployed on cluster group, it will stay > until, last node leaves the cluster. > > In case the cluster node on which the service was deployed crashes or stops, > Ignite will automatically redeploy it on another node. [1] > > [1]: https://apacheignite.readme.io/docs/cluster-singletons > <https://apacheignite.readme.io/docs/cluster-singletons> > > On Mon, Jul 11, 2016 at 7:48 AM, Kamal C <[email protected] > <mailto:[email protected]>> wrote: > Sorry for polluting the mailing list. > > Ignition.stop(false); // internally stops / cancels the local Ignite service. > > Can anyone answer for the 2nd question? > > --Kamal > > On Mon, Jul 11, 2016 at 10:00 AM, Kamal C <[email protected] > <mailto:[email protected]>> wrote: > Vladislav, > > I've applied your suggestion. Still, Ignite closes the service running in all > the nodes, > > ClusterGroup grp = ignite.cluster().forNode(ignite.cluster().localNode()); > ignite.services(grp).cancel(calcService); > > Exception > > class org.apache.ignite.IgniteException: Failed to find deployed service: > CalcService > at > org.apache.ignite.internal.processors.service.GridServiceProxy.invokeMethod(GridServiceProxy.java:155) > at > org.apache.ignite.internal.processors.service.GridServiceProxy$ProxyInvocationHandler.invoke(GridServiceProxy.java:331) > at com.sun.proxy.$Proxy28.add(Unknown Source) > at > my.apache.ignite.examples.servicegrid.ServiceDeployer.useService(ServiceDeployer.java:63) > > > Re-framing my question: > > - Is Service.cancel() method is not a appropriate place for resource > cleanups on shutdown? > - How to tell Ignite to move a clustered singleton service from one node to > another with external scripts? > > -- Kamal > > On Sat, Jul 9, 2016 at 1:07 AM, Vladislav Pyatkov <[email protected] > <mailto:[email protected]>> wrote: > Hello Kamal, > > Try to use Ignite.services(ClusterGroup > <http://ignite.apache.org/releases/1.0.0/javadoc/org/apache/ignite/cluster/ClusterGroup.html> > grp) for local node group. > > Ignition.ignite().services(Ignition.ignite().cluster().localNode()).cancel(serviceName); > > On Fri, Jul 8, 2016 at 9:48 AM, Kamal C <[email protected] > <mailto:[email protected]>> wrote: > Hi, > > I have a 3 node Ignite cluster and deployed a service using Node > Singleton approach. The service started to run in all the 3 nodes. > > Whenever a node stopped, the below line gets called as I'm doing resource > cleanups inside IgniteService.cancel(ServiceContext context) method. > > Ignition.ignite().services().cancel(serviceName); > > But, it cancels the service from all the nodes. How to cancel a locally > running Ignite service gracefully? > > -- > Kamal > > > > -- > Vladislav Pyatkov > > > > > > -- > Vladislav Pyatkov >
