public class IgniteClusterImpl extends ClusterGroupAdapter implements IgniteClusterEx, Externalizable
ctx, p, subjId
Constructor and Description |
---|
IgniteClusterImpl()
Required by
Externalizable . |
IgniteClusterImpl(GridKernalContext ctx) |
Modifier and Type | Method and Description |
---|---|
void |
clearNodeMap()
Clears node local map.
|
IgniteFuture<?> |
clientReconnectFuture()
If local client node disconnected from cluster returns future
that will be completed when client reconnected.
|
void |
clientReconnectFuture(IgniteFuture<?> reconnecFut) |
ClusterGroup |
forLocal()
Gets a cluster group consisting from the local node.
|
<R> IgniteFuture<R> |
future()
Gets and resets future for previous asynchronous operation.
|
boolean |
isAsync() |
ClusterNode |
localNode()
Gets local grid node.
|
<K,V> ConcurrentMap<K,V> |
nodeLocalMap()
Gets node-local storage instance.
|
boolean |
pingNode(UUID nodeId)
Pings a remote node.
|
void |
readExternal(ObjectInput in) |
protected Object |
readResolve()
Reconstructs object on unmarshalling.
|
void |
resetMetrics()
Resets local I/O, job, and task execution metrics.
|
void |
restartNodes()
Restarts nodes satisfying optional set of predicates.
|
void |
restartNodes(Collection<UUID> ids)
Restarts nodes defined by provided IDs.
|
Collection<ClusterStartNodeResult> |
startNodes(Collection<Map<String,Object>> hosts,
Map<String,Object> dflts,
boolean restart,
int timeout,
int maxConn)
Starts one or more nodes on remote host(s).
|
Collection<ClusterStartNodeResult> |
startNodes(File file,
boolean restart,
int timeout,
int maxConn)
Starts one or more nodes on remote host(s).
|
IgniteFuture<Collection<ClusterStartNodeResult>> |
startNodesAsync(Collection<Map<String,Object>> hosts,
Map<String,Object> dflts,
boolean restart,
int timeout,
int maxConn)
Starts one or more nodes on remote host(s) asynchronously.
|
IgniteFuture<Collection<ClusterStartNodeResult>> |
startNodesAsync(File file,
boolean restart,
int timeout,
int maxConn)
Starts one or more nodes on remote host(s) asynchronously.
|
void |
stopNodes()
Stops nodes satisfying optional set of predicates.
|
void |
stopNodes(Collection<UUID> ids)
Stops nodes defined by provided IDs.
|
Collection<ClusterNode> |
topology(long topVer)
Gets a topology by version.
|
long |
topologyVersion()
Gets current topology version.
|
String |
toString() |
IgniteCluster |
withAsync()
Gets instance of this component with asynchronous mode enabled.
|
void |
writeExternal(ObjectOutput out) |
compute, events, executorService, forAttribute, forCacheNodes, forCacheNodes, forClientNodes, forClients, forDaemons, forDataNodes, forHost, forHost, forIgfsMetadataDataNodes, forNode, forNodeId, forNodeIds, forNodes, forOldest, forOthers, forOthers, forPredicate, forRandom, forRemotes, forServers, forSubjectId, forYoungest, guard, hostNames, ignite, message, metrics, node, node, nodes, predicate, services, setKernalContext, unguard
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forCacheNodes, forIgfsMetadataDataNodes, forSubjectId
forAttribute, forCacheNodes, forClientNodes, forClients, forDaemons, forDataNodes, forHost, forHost, forNode, forNodeId, forNodeIds, forNodes, forOldest, forOthers, forOthers, forPredicate, forRandom, forRemotes, forServers, forYoungest, hostNames, ignite, metrics, node, node, nodes, predicate
public IgniteClusterImpl()
Externalizable
.public IgniteClusterImpl(GridKernalContext ctx)
ctx
- Kernal context.public ClusterGroup forLocal()
forLocal
in interface IgniteCluster
public ClusterNode localNode()
localNode
in interface IgniteCluster
public <K,V> ConcurrentMap<K,V> nodeLocalMap()
Node-local values are similar to thread locals in a way that these values are not distributed and kept only on local node (similar like thread local values are attached to the current thread only). Node-local values are used primarily by closures executed from the remote nodes to keep intermediate state on the local node between executions.
There's only one instance of node local storage per local node. Node local storage is
based on ConcurrentMap
and is safe for multi-threaded access.
nodeLocalMap
in interface IgniteCluster
public boolean pingNode(UUID nodeId)
Discovery SPIs usually have some latency in discovering failed nodes. Hence, communication to remote nodes may fail at times if an attempt was made to establish communication with a failed node. This method can be used to check if communication has failed due to node failure or due to some other reason.
pingNode
in interface IgniteCluster
nodeId
- ID of a node to ping.true
if node for a given ID is alive, false
otherwise.DiscoverySpi
public long topologyVersion()
TcpDiscoverySpi
) topology versions
are sequential - they start from '1'
and get incremented every time whenever a
node joins or leaves. For other discovery SPIs topology versions may not be (and likely are
not) sequential.topologyVersion
in interface IgniteCluster
public Collection<ClusterNode> topology(long topVer) throws UnsupportedOperationException
null
if topology history storage doesn't contain
specified topology version (history currently keeps last 1000
snapshots).topology
in interface IgniteCluster
topVer
- Topology version.null
otherwise.UnsupportedOperationException
- If underlying SPI implementation does not support
topology history. Currently only TcpDiscoverySpi
supports topology history.public Collection<ClusterStartNodeResult> startNodes(File file, boolean restart, int timeout, int maxConn) throws IgniteException
This method takes INI file which defines all startup parameters. It can contain one or
more sections, each for a host or for range of hosts (note that they must have different
names) and a special 'defaults
' section with default values. They are applied to
undefined parameters in host's sections.
Returned result is collection of tuples. Each tuple corresponds to one node start attempt and contains hostname, success flag and error message if attempt was not successful. Note that successful attempt doesn't mean that node was actually started and joined topology. For large topologies (> 100s nodes) it can take over 10 minutes for all nodes to start. See individual node logs for details.
Supports asynchronous execution (see IgniteAsyncSupport
).
startNodes
in interface IgniteCluster
file
- Configuration file.restart
- Whether to stop existing nodes. If true
, all existing
nodes on the host will be stopped before starting new ones. If
false
, nodes will be started only if there are less
nodes on the host than expected.timeout
- Connection timeout.maxConn
- Number of parallel SSH connections to one host.IgniteException
- In case of error.public IgniteFuture<Collection<ClusterStartNodeResult>> startNodesAsync(File file, boolean restart, int timeout, int maxConn) throws IgniteException
This method takes INI file which defines all startup parameters. It can contain one or
more sections, each for a host or for range of hosts (note that they must have different
names) and a special 'defaults
' section with default values. They are applied to
undefined parameters in host's sections.
Completed future contains collection of tuples. Each tuple corresponds to one node start attempt and contains hostname, success flag and error message if attempt was not successful. Note that successful attempt doesn't mean that node was actually started and joined topology. For large topologies (> 100s nodes) it can take over 10 minutes for all nodes to start. See individual node logs for details.
startNodesAsync
in interface IgniteCluster
file
- Configuration file.restart
- Whether to stop existing nodes. If true
, all existing
nodes on the host will be stopped before starting new ones. If
false
, nodes will be started only if there are less
nodes on the host than expected.timeout
- Connection timeout.maxConn
- Number of parallel SSH connections to one host.IgniteException
- In case of error.public Collection<ClusterStartNodeResult> startNodes(Collection<Map<String,Object>> hosts, @Nullable Map<String,Object> dflts, boolean restart, int timeout, int maxConn) throws IgniteException
Each map in hosts
collection
defines startup parameters for one host or for a range of hosts. The following
parameters are supported:
Name | Type | Description |
---|---|---|
host | String |
Hostname (required). Can define several hosts if their IPs are sequential.
E.g., 10.0.0.1~5 defines range of five IP addresses. Other
parameters are applied to all hosts equally.
|
port | Integer | Port number (default is 22 ). |
uname | String | Username (if not defined, current local username will be used). |
passwd | String | Password (if not defined, private key file must be defined). |
key | File | Private key file (if not defined, password must be defined). |
nodes | Integer |
Expected number of nodes on the host. If some nodes are started
already, then only remaining nodes will be started. If current count of
nodes is equal to this number, and restart flag is false ,
then nothing will happen.
|
igniteHome | String | Path to Ignite installation folder. If not defined, IGNITE_HOME environment variable must be set on remote hosts. |
cfg | String | Path to configuration file (relative to igniteHome ). |
script | String |
Custom startup script file name and path (relative to igniteHome ).
You can also specify a space-separated list of parameters in the same
string (for example: "bin/my-custom-script.sh -v" ).
|
dflts
map defines default values. They are applied to undefined parameters in
hosts
collection.
Returned result is collection of tuples. Each tuple corresponds to one node start attempt and contains hostname, success flag and error message if attempt was not successful. Note that successful attempt doesn't mean that node was actually started and joined topology. For large topologies (> 100s nodes) it can take over 10 minutes for all nodes to start. See individual node logs for details.
Supports asynchronous execution (see IgniteAsyncSupport
).
startNodes
in interface IgniteCluster
hosts
- Startup parameters.dflts
- Default values.restart
- Whether to stop existing nodes. If true
, all existing
nodes on the host will be stopped before starting new ones. If
false
, nodes will be started only if there are less
nodes on the host than expected.timeout
- Connection timeout in milliseconds.maxConn
- Number of parallel SSH connections to one host.IgniteException
- In case of error.public IgniteFuture<Collection<ClusterStartNodeResult>> startNodesAsync(Collection<Map<String,Object>> hosts, @Nullable Map<String,Object> dflts, boolean restart, int timeout, int maxConn) throws IgniteException
Each map in hosts
collection
defines startup parameters for one host or for a range of hosts. The following
parameters are supported:
Name | Type | Description |
---|---|---|
host | String |
Hostname (required). Can define several hosts if their IPs are sequential.
E.g., 10.0.0.1~5 defines range of five IP addresses. Other
parameters are applied to all hosts equally.
|
port | Integer | Port number (default is 22 ). |
uname | String | Username (if not defined, current local username will be used). |
passwd | String | Password (if not defined, private key file must be defined). |
key | File | Private key file (if not defined, password must be defined). |
nodes | Integer |
Expected number of nodes on the host. If some nodes are started
already, then only remaining nodes will be started. If current count of
nodes is equal to this number, and restart flag is false ,
then nothing will happen.
|
igniteHome | String | Path to Ignite installation folder. If not defined, IGNITE_HOME environment variable must be set on remote hosts. |
cfg | String | Path to configuration file (relative to igniteHome ). |
script | String |
Custom startup script file name and path (relative to igniteHome ).
You can also specify a space-separated list of parameters in the same
string (for example: "bin/my-custom-script.sh -v" ).
|
dflts
map defines default values. They are applied to undefined parameters in
hosts
collection.
Completed future contains collection of tuples. Each tuple corresponds to one node start attempt and contains hostname, success flag and error message if attempt was not successful. Note that successful attempt doesn't mean that node was actually started and joined topology. For large topologies (> 100s nodes) it can take over 10 minutes for all nodes to start. See individual node logs for details.
startNodesAsync
in interface IgniteCluster
hosts
- Startup parameters.dflts
- Default values.restart
- Whether to stop existing nodes. If true
, all existing
nodes on the host will be stopped before starting new ones. If
false
, nodes will be started only if there are less
nodes on the host than expected.timeout
- Connection timeout in milliseconds.maxConn
- Number of parallel SSH connections to one host.IgniteException
- In case of error.public void stopNodes() throws IgniteException
NOTE: System.exit(Ignition.KILL_EXIT_CODE)
will be executed on each
stopping node. If you have other applications running in the same JVM along with Ignition,
those applications will be stopped as well.
stopNodes
in interface IgniteCluster
IgniteException
- In case of error.public void stopNodes(Collection<UUID> ids) throws IgniteException
NOTE: System.exit(Ignition.KILL_EXIT_CODE)
will be executed on each
stopping node. If you have other applications running in the same JVM along with Ignition,
those applications will be stopped as well.
stopNodes
in interface IgniteCluster
ids
- IDs defining nodes to stop.IgniteException
- In case of error.public void restartNodes() throws IgniteException
NOTE: this command only works for grid nodes started with Ignition
ignite.sh
or ignite.bat
scripts.
restartNodes
in interface IgniteCluster
IgniteException
- In case of error.public void restartNodes(Collection<UUID> ids) throws IgniteException
NOTE: this command only works for grid nodes started with Ignition
ignite.sh
or ignite.bat
scripts.
restartNodes
in interface IgniteCluster
ids
- IDs defining nodes to restart.IgniteException
- In case of error.public void resetMetrics()
resetMetrics
in interface IgniteCluster
public IgniteCluster withAsync()
withAsync
in interface IgniteCluster
withAsync
in interface IgniteAsyncSupport
public boolean isAsync()
isAsync
in interface IgniteAsyncSupport
True
if asynchronous mode is enabled.public <R> IgniteFuture<R> future()
future
in interface IgniteAsyncSupport
public void clearNodeMap()
public void clientReconnectFuture(IgniteFuture<?> reconnecFut)
reconnecFut
- Reconnect future.@Nullable public IgniteFuture<?> clientReconnectFuture()
clientReconnectFuture
in interface IgniteCluster
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
readExternal
in class ClusterGroupAdapter
IOException
ClassNotFoundException
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
writeExternal
in class ClusterGroupAdapter
IOException
protected Object readResolve() throws ObjectStreamException
readResolve
in class ClusterGroupAdapter
ObjectStreamException
- Thrown in case of unmarshalling error.
Follow @ApacheIgnite
Ignite Fabric : ver. 2.0.0 Release Date : April 30 2017