@Singleton public class Cluster extends Object
| Constructor and Description |
|---|
Cluster(org.elasticsearch.client.Client client,
IndexSetRegistry indexSetRegistry,
ScheduledExecutorService scheduler,
com.github.joschi.jadconfig.util.Duration requestTimeout) |
| Modifier and Type | Method and Description |
|---|---|
org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse |
deflectorHealth()
Requests the cluster health for the current write index.
|
Map<String,org.elasticsearch.action.admin.cluster.node.info.NodeInfo> |
getAllNodes() |
Map<String,org.elasticsearch.action.admin.cluster.node.info.NodeInfo> |
getDataNodes() |
Map<String,org.elasticsearch.action.admin.cluster.node.stats.NodeStats> |
getNodesStats(String... nodesIds) |
org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse |
health()
Requests the cluster health for all indices managed by Graylog.
|
boolean |
isConnected()
Check if the Elasticsearch
Node is connected and that there are other nodes
in the cluster. |
boolean |
isDeflectorHealthy()
Check if the deflector (write index) health status is not
ClusterHealthStatus.RED and that the
deflector is up. |
boolean |
isHealthy()
Check if the cluster health status is not
ClusterHealthStatus.RED and that the
deflector is up. |
String |
nodeIdToHostName(String nodeId) |
String |
nodeIdToName(String nodeId) |
void |
updateDataNodeList(Map<String,org.elasticsearch.cluster.node.DiscoveryNode> nodes) |
void |
waitForConnectedAndDeflectorHealthy()
Blocks until the Elasticsearch cluster and current write index is healthy again or the default timeout fires.
|
void |
waitForConnectedAndDeflectorHealthy(long timeout,
TimeUnit unit)
Blocks until the Elasticsearch cluster and current write index is healthy again or the given timeout fires.
|
@Inject
public Cluster(org.elasticsearch.client.Client client,
IndexSetRegistry indexSetRegistry,
@Named(value="daemonScheduler")
ScheduledExecutorService scheduler,
@Named(value="elasticsearch_request_timeout")
com.github.joschi.jadconfig.util.Duration requestTimeout)
public org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse health()
public org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse deflectorHealth()
public Map<String,org.elasticsearch.action.admin.cluster.node.info.NodeInfo> getDataNodes()
public Map<String,org.elasticsearch.action.admin.cluster.node.info.NodeInfo> getAllNodes()
public Map<String,org.elasticsearch.action.admin.cluster.node.stats.NodeStats> getNodesStats(String... nodesIds)
public boolean isConnected()
Node is connected and that there are other nodes
in the cluster.true if the Elasticsearch client is up and the cluster contains other nodes, false otherwisepublic boolean isHealthy()
ClusterHealthStatus.RED and that the
deflector is up.true if the the cluster is healthy and the deflector is up, false otherwisepublic boolean isDeflectorHealthy()
ClusterHealthStatus.RED and that the
deflector is up.true if the deflector is healthy and up, false otherwisepublic void waitForConnectedAndDeflectorHealthy(long timeout,
TimeUnit unit)
throws InterruptedException,
TimeoutException
timeout - the timeout valueunit - the timeout unitInterruptedExceptionTimeoutExceptionpublic void waitForConnectedAndDeflectorHealthy()
throws InterruptedException,
TimeoutException
InterruptedExceptionTimeoutExceptionCopyright © 2012–2017 Graylog, Inc.. All rights reserved.