public interface ClusterGroup
IgniteCluster interface itself also extends ClusterGroup which makes
an instance of IgniteCluster into a cluster group containing all cluster nodes.
'forXXX(...)' methods will create a child cluster group
from the existing cluster group. If you create a new cluster group from the current one, then
the resulting cluster group will include a subset of nodes from the current one. The following
code shows how to create and nest cluster groups:
Ignite ignite = Ignition.ignite();
IgniteCluster cluster = ignite.cluster();
// Cluster group over remote nodes.
ClusterGroup remoteNodes = cluster.forRemotes();
// Cluster group over random remote node.
ClusterGroup randomNode = remoteNodes.forRandom();
// Cluster group over all nodes with cache named "myCache" enabled.
ClusterGroup cacheNodes = cluster.forCacheNodes("myCache");
// Cluster group over all nodes that have the user attribute "group" set to the value "worker".
ClusterGroup workerNodes = cluster.forAttribute("group", "worker");
| Modifier and Type | Method and Description |
|---|---|
ClusterGroup |
forAttribute(String name,
@Nullable Object val)
Creates a new cluster group for nodes containing given name and value
specified in user attributes.
|
ClusterGroup |
forCacheNodes(String cacheName)
Creates a cluster group for all nodes that have cache with specified name, either in client or server modes.
|
ClusterGroup |
forClientNodes(String cacheName)
Creates a cluster group for all client nodes that access cache with the specified name.
|
ClusterGroup |
forClients()
Creates a cluster group of nodes started in client mode.
|
ClusterGroup |
forDataNodes(String cacheName)
Creates a cluster group for all data nodes that have the cache with the specified name running.
|
ClusterGroup |
forHost(ClusterNode node)
Gets cluster group consisting from the nodes in this cluster group residing on the
same host as the given node.
|
ClusterGroup |
forHost(String host,
String... hosts)
Gets cluster group consisting from the nodes running on the hosts specified.
|
ClusterGroup |
forNode(ClusterNode node,
ClusterNode... nodes)
Creates a cluster group for the given node.
|
ClusterGroup |
forNodeId(UUID id,
UUID... ids)
Creates a cluster group for a node with the specified ID.
|
ClusterGroup |
forNodeIds(Collection<UUID> ids)
Creates a cluster group over nodes with specified node IDs.
|
ClusterGroup |
forNodes(Collection<? extends ClusterNode> nodes)
Creates a cluster group over a given set of nodes.
|
ClusterGroup |
forOldest()
Creates a cluster group with one oldest node from the current cluster group.
|
ClusterGroup |
forOthers(ClusterGroup prj)
Creates a cluster group for nodes not included into the given cluster group.
|
ClusterGroup |
forOthers(ClusterNode node,
ClusterNode... nodes)
Creates a cluster group for nodes other than the given nodes.
|
ClusterGroup |
forPredicate(IgnitePredicate<ClusterNode> p)
Creates a new cluster group which includes all nodes that pass the given predicate filter.
|
ClusterGroup |
forRandom()
Creates a cluster group with one random node from the current cluster group.
|
ClusterGroup |
forRemotes()
Gets cluster group consisting from the nodes in this cluster group excluding the local node.
|
ClusterGroup |
forServers()
Creates a cluster group of nodes started in server mode.
|
ClusterGroup |
forYoungest()
Creates a cluster group with one youngest node in the current cluster group.
|
Collection<String> |
hostNames()
Gets the read-only collection of hostnames in this cluster group.
|
Ignite |
ignite()
Gets instance of grid.
|
ClusterMetrics |
metrics()
Gets a metrics snapshot for this cluster group.
|
ClusterNode |
node()
Gets first node from the list of nodes in this cluster group.
|
ClusterNode |
node(UUID nid)
Gets a node for given ID from this cluster group.
|
Collection<ClusterNode> |
nodes()
Gets the read-only collection of nodes in this cluster group.
|
IgnitePredicate<ClusterNode> |
predicate()
Gets predicate that defines a subset of nodes for this cluster group.
|
Ignite ignite()
ClusterGroup forNodes(Collection<? extends ClusterNode> nodes)
nodes - Collection of nodes to create the cluster group from.ClusterGroup forNode(ClusterNode node, ClusterNode... nodes)
node - Node to create cluster group for.nodes - Optional additional nodes to include into the cluster group.ClusterGroup forOthers(ClusterNode node, ClusterNode... nodes)
node - Node to exclude from the new cluster group.nodes - Optional additional nodes to exclude from the cluster group.ClusterGroup forOthers(ClusterGroup prj)
prj - Cluster group to exclude from the new cluster group.ClusterGroup forNodeIds(Collection<UUID> ids)
ids - Collection of node IDs.ClusterGroup forNodeId(UUID id, UUID... ids)
id - Node ID to get the cluster group for.ids - Optional additional node IDs to include into the cluster group.ClusterGroup forPredicate(IgnitePredicate<ClusterNode> p)
p - Predicate filter for nodes to include into the cluster group.ClusterGroup forAttribute(String name, @Nullable @Nullable Object val)
User attributes for every node are optional and can be specified in
grid node configuration. See IgniteConfiguration.getUserAttributes()
for more information.
name - Name of the attribute.val - Optional attribute value to match.ClusterGroup forServers()
Ignition.setClientMode(boolean),
IgniteConfiguration.setClientMode(boolean)ClusterGroup forClients()
Ignition.setClientMode(boolean),
IgniteConfiguration.setClientMode(boolean)ClusterGroup forCacheNodes(String cacheName)
cacheName - Cache name.ClusterGroup forDataNodes(String cacheName)
cacheName - Cache name.ClusterGroup forClientNodes(String cacheName)
cacheName - Cache name.ClusterGroup forRemotes()
ClusterGroup forHost(ClusterNode node)
node - Node to select the host for.ClusterGroup forHost(String host, String... hosts)
host - Host name to get nodes to put in clusterhosts - Host names to get nodes to put in cluster.ClusterGroup forRandom()
ClusterGroup forOldest()
Use node() method to get the oldest node.
ClusterGroup forYoungest()
Collection<ClusterNode> nodes()
ClusterNode node(UUID nid)
nid - Node ID.null, if such node does not exist.ClusterNode node()
null if the cluster group is empty.Collection<String> hostNames()
IgnitePredicate<ClusterNode> predicate()
ClusterMetrics metrics() throws IgniteException
IgniteException - If this cluster group is empty.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.16.0 Release Date : December 15 2023