Do services run on client nodes

classic Classic list List threaded Threaded
4 messages Options
pgarg pgarg
Reply | Threaded
Open this post in threaded view
|

Do services run on client nodes

asked by adam miller

Now that there is the ability to define a client node using Ignition.setClientMode(true), what happens with Node Singleton or Cluster Singleton services?

Does a Node Singleton service get deployed on the client node?

Will a Cluster Singleton service ever get assigned to a client node?

-----
This post is migrated from now discontinued Apache Ignite forum at
http://apacheignite.readme.io/v1.0/discuss
pgarg pgarg
Reply | Threaded
Open this post in threaded view
|

Re: Do services run on client nodes

commented by alexey goncharuk

Currently services do not take into account the client mode flag during deployment, so cluster singleton will be deployed on a client node. However, if you want to skip client nodes for service deployment, you can use CacheConfiguration#SERVER_NODES as the node predicate in service configuration.

-----
This post is migrated from now discontinued Apache Ignite forum at
http://apacheignite.readme.io/v1.0/discuss
pgarg pgarg
Reply | Threaded
Open this post in threaded view
|

Re: Do services run on client nodes

commented by adam miller

I'm sorry, I don't understand how that would be configured. I see that ServiceConfiguration has a method, setNodeFilter.
So calling setNodeFilter with an IgnitePredicate<ClusterNode> p = n -> !n.isLocal() looks like it would do the trick in code.

Is it possible to specify this in configuration?

-----
This post is migrated from now discontinued Apache Ignite forum at
http://apacheignite.readme.io/v1.0/discuss
pgarg pgarg
Reply | Threaded
Open this post in threaded view
|

Re: Do services run on client nodes

commented by alexey goncharuk

Adam,

Using isLocal method inside a filter may be error-prone because the result of filter evaluation depends on the node on which this filter gets evaluated.

Here is the code snippet that deploys a service only on server nodes:

ServiceConfiguration svcCfg = new ServiceConfiguration();

svcCfg.setService(new MyService());
svcCfg.setNodeFilter(CacheConfiguration.SERVER_NODES);
svcCfg.setMaxPerNodeCount(1);

ignite.services().deploy(svcCfg);


-----
This post is migrated from now discontinued Apache Ignite forum at
http://apacheignite.readme.io/v1.0/discuss