Interface representing a single cluster node. Use
#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
org.apache.ignite.compute.ComputeTask#map(List,Object) method.
Cluster Node Attributes
You can use cluster node attributes to provide static information about a node.
This information is initialized once within a cluster, during the node startup, and
remains the same throughout the lifetime of a node. Use
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
org.apache.ignite.spi.IgniteSpi#getName().
-
spiName.org.apache.ignite.spi.ver - SPI version for every SPI,
where
spiName is the name of the SPI (see
org.apache.ignite.spi.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"));
}
Cluster Node Metrics
Cluster node metrics (see
#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
org.apache.ignite.configuration.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
org.apache.ignite.compute.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
jconsolethat comes with JDK as it also provides ability to view any node parameter
as a graph.