public interface ClusterNode extends BaselineNode
attribute(String)
or
metrics()
to get static and dynamic information about cluster nodes.
ClusterNode
list, which includes all nodes within task topology, is provided
to ComputeTask.map(List, Object)
method.
IgniteConfiguration.getUserAttributes()
method to initialize your custom
node attributes at startup. Here is an example of how to assign an attribute to a node at startup:
<bean class="org.apache.ignite.configuration.IgniteConfiguration"> ... <property name="userAttributes"> <map> <entry key="worker" value="true"/> </map> </property> ... </bean>
The system adds the following attributes automatically:
{@link System#getProperties()}
- All system properties.{@link System#getenv(String)}
- All environment properties.org.ignite.build.ver
- Ignite build version.org.apache.ignite.jit.name
- Name of JIT compiler used.org.apache.ignite.net.itf.name
- Name of network interface.org.apache.ignite.user.name
- Operating system user name.org.apache.ignite.ignite.name
- Ignite name (see Ignite.name()
).spiName.org.apache.ignite.spi.class
- SPI implementation class for every SPI,
where spiName
is the name of the SPI (see IgniteSpi.getName()
.
spiName.org.apache.ignite.spi.ver
- SPI version for every SPI,
where spiName
is the name of the SPI (see IgniteSpi.getName()
.
Note that all System and Environment properties for all nodes are automatically included
into node attributes. This gives you an ability to get any information specified
in System.getProperties()
about any node. So for example, in order to print out
information about Operating System for all nodes you would do the following:
for (ClusterNode node : ignite.cluster().nodes()) { System.out.println("Operating system name: " + node.getAttribute("os.name")); System.out.println("Operating system architecture: " + node.getAttribute("os.arch")); System.out.println("Operating system version: " + node.getAttribute("os.version")); }
metrics()
) are updated frequently for all nodes
and can be used to get dynamic information about a node. The frequency of update
is controlled by IgniteConfiguration.getMetricsUpdateFrequency()
parameter.
The metrics data will be updated every 2
seconds by default.
Grid node metrics provide information that can frequently change,
such as Heap and Non-Heap memory utilization, CPU load, number of active and waiting
grid jobs, etc... This information can become useful during job collision resolution or
ComputeTask.map(List, Object)
operation when jobs are
assigned to remote nodes for execution.
Local node metrics are registered as MBean
and can be accessed from
any JMX management console. The simplest way is to use standard jconsole
that comes with JDK as it also provides ability to view any node parameter
as a graph.
Modifier and Type | Method and Description |
---|---|
Collection<String> |
addresses()
Gets collection of addresses this node is known by.
|
<T> T |
attribute(String name)
Gets a node attribute.
|
Map<String,Object> |
attributes()
Gets all node attributes.
|
Object |
consistentId()
Gets consistent globally unique node ID.
|
Collection<String> |
hostNames()
Gets collection of host names this node is known by.
|
UUID |
id()
Gets globally unique node ID.
|
boolean |
isClient()
Whether this node is cache client (see
IgniteConfiguration.isClientMode() ). |
boolean |
isDaemon()
Tests whether or not this node is a daemon.
|
boolean |
isLocal()
Tests whether or not this node is a local node.
|
ClusterMetrics |
metrics()
Gets metrics snapshot for this node.
|
long |
order()
Node order within grid topology.
|
IgniteProductVersion |
version()
Gets node version.
|
UUID id()
Object consistentId()
id()
method,
this method returns consistent node ID which survives node restarts.consistentId
in interface BaselineNode
<T> T attribute(String name)
IgniteConfiguration.getUserAttributes()
method.
The system adds the following attributes automatically:
{@link System#getProperties()}
- All system properties.{@link System#getenv(String)}
- All environment properties.IgniteNodeAttributes
Note that attributes cannot be changed at runtime.
attribute
in interface BaselineNode
T
- Attribute Type.name
- Attribute name. Note that attribute names starting with
org.apache.ignite
are reserved for internal use.null
if such an attribute does not exist.ClusterMetrics metrics()
ClusterMetrics.getCurrentCpuLoad()
method and use it during ComputeTask.map(List, Object)
or during collision
resolution.
Node metrics are updated with some delay which is controlled by
IgniteConfiguration.getMetricsUpdateFrequency()
parameter.
By default the update will happen every 2
seconds.
Map<String,Object> attributes()
IgniteConfiguration.getUserAttributes()
method.
The system adds the following attributes automatically:
{@link System#getProperties()}
- All system properties.{@link System#getenv(String)}
- All environment properties.IgniteNodeAttributes
Note that attributes cannot be changed at runtime.
attributes
in interface BaselineNode
Collection<String> addresses()
If IgniteConfiguration.getLocalHost()
value isn't null
node will try to use that
address for all communications and returned collection will contain only that address.
If it is null
then local wildcard address will be used, and Ignite
will make the best effort to supply all addresses of that node in returned collection.
Collection<String> hostNames()
If IgniteConfiguration.getLocalHost()
value isn't null
node will try to use
the host name of that resolved address for all communications and
returned collection will contain only that host name.
If that host name can not be resolved then ip address returned by method addresses()
is used.
If IgniteConfiguration.getLocalHost()
value is null
then local wildcard address will be used,
and this method returns host names of all addresses of that node.
Note: the loopback address will be omitted in results.
long order()
NOTE: in cases when discovery SPI doesn't support ordering Ignite cannot guarantee that orders on all nodes will be unique or chronologically correct. If such guarantee is required - make sure use discovery SPI that provides ordering.
IgniteProductVersion version()
boolean isLocal()
True
if this node is a local node, false
otherwise.boolean isDaemon()
Daemon nodes are the usual cluster nodes that participate in topology but are not
visible on the main APIs, i.e. they are not part of any cluster group. The only
way to see daemon nodes is to use ClusterGroup.forDaemons()
method.
Daemon nodes are used primarily for management and monitoring functionality that is build on Ignite and needs to participate in the topology, but should be excluded from the "normal" topology, so that they won't participate in the task execution or data grid operations.
Application code should never use daemon nodes.
True
if this node is a daemon, false
otherwise.boolean isClient()
IgniteConfiguration.isClientMode()
).True if client
.IgniteConfiguration.isClientMode()
GridGain In-Memory Computing Platform : ver. 8.9.15 Release Date : December 3 2024