Apache Ignite Documentation

GridGain Developer Hub - Apache Ignitetm

Welcome to the Apache Ignite developer hub run by GridGain. Here you'll find comprehensive guides and documentation to help you start working with Apache Ignite as quickly as possible, as well as support if you get stuck.

 

GridGain also provides Community Edition which is a distribution of Apache Ignite made available by GridGain. It is the fastest and easiest way to get started with Apache Ignite. The Community Edition is generally more stable than the Apache Ignite release available from the Apache Ignite website and may contain extra bug fixes and features that have not made it yet into the release on the Apache website.

 

Let's jump right in!

 

Documentation     Ask a Question     Download

 

Javadoc     Scaladoc     Examples

Cluster Singletons

Define various guaranteed cluster singletons.

Overview

IgniteServices facade allows to deploy any number of services on any of the grid nodes. However, the most commonly used feature is to deploy singleton services on the cluster. Ignite will manage the singleton contract regardless of topology changes and node crashes.

Note that in case of topology changes, due to network delays, there may be a temporary situation when a singleton service instance will be active on more than one node (e.g. crash detection delay).

Cluster Singleton

You can deploy a cluster-wide singleton service. Ignite will guarantee that there is always one instance of the service in the cluster. In case the cluster node on which the service was deployed crashes or stops, Ignite will automatically redeploy it on another node. However, if the node on which the service is deployed remains in topology, then the service will always be deployed on that node only, regardless of topology changes.

IgniteServices svcs = ignite.services();

svcs.deployClusterSingleton("myClusterSingleton", new MyService());

The above method is analogous to calling

svcs.deployMultiple("myClusterSingleton", new MyService(), 1, 1)

Node Singleton

You can deploy a per-node singleton service. Ignite will guarantee that there is always one instance of the service running on each node. Whenever new nodes are started within the cluster group, Ignite will automatically deploy one instance of the service on every new node.

IgniteServices svcs = ignite.services();

svcs.deployNodeSingleton("myNodeSingleton", new MyService());

The above method is analogous to calling

svcs.deployMultiple("myNodeSingleton", new MyService(), 0, 1);

Cache Key Affinity Singleton

You can deploy one instance of this service on the primary node for a given affinity key. Whenever topology changes and primary key node assignment changes, Ignite will always make sure that the service is undeployed on the previous primary node and is deployed on the new primary node.

IgniteServices svcs = ignite.services();

svcs.deployKeyAffinitySingleton("myKeySingleton", new MyService(), "myCache", new MyCacheKey());

The above method is analogous to calling

IgniteServices svcs = ignite.services();

ServiceConfiguration cfg = new ServiceConfiguration();
 
cfg.setName("myKeySingleton");
cfg.setService(new MyService());
cfg.setCacheName("myCache");
cfg.setAffinityKey(new MyCacheKey());
cfg.setTotalCount(1);
cfg.setMaxPerNodeCount(1);
 
svcs.deploy(cfg);