Class Cluster

java.lang.Object
org.graylog2.indexer.cluster.Cluster

@Singleton public class Cluster extends Object
  • Constructor Details

  • Method Details

    • health

      public Optional<HealthStatus> health()
      Requests the cluster health for all indices managed by Graylog. (default: graylog_*)
      Returns:
      the cluster health response
    • deflectorHealth

      public Optional<HealthStatus> deflectorHealth()
      Requests the cluster health for the current write index. (deflector) This can be used to decide if the current write index is healthy and writable even when older indices have problems.
      Returns:
      the cluster health response
    • getFileDescriptorStats

      public Set<NodeFileDescriptorStats> getFileDescriptorStats()
    • getDiskUsageStats

      public Set<NodeDiskUsageStats> getDiskUsageStats()
    • getClusterAllocationDiskSettings

      public ClusterAllocationDiskSettings getClusterAllocationDiskSettings()
    • nodeIdToName

      public Optional<String> nodeIdToName(String nodeId)
    • nodeIdToHostName

      public Optional<String> nodeIdToHostName(String nodeId)
    • isConnected

      public boolean isConnected()
      Check if Elasticsearch is available and that there are data nodes in the cluster.
      Returns:
      true if the Elasticsearch client is up and the cluster contains data nodes, false otherwise
    • isHealthy

      public boolean isHealthy()
      Check if the cluster health status is not RED and that the deflector is up.
      Returns:
      true if the cluster is healthy and the deflector is up, false otherwise
    • indexSetRegistryIsUp

      public boolean indexSetRegistryIsUp()
      Check if the index registry is up. For logging purposes.
      Returns:
      true, if it's up
    • isDeflectorHealthy

      public boolean isDeflectorHealthy()
      Check if the deflector (write index) health status is not RED and that the deflector is up.
      Returns:
      true if the deflector is healthy and up, false otherwise
    • waitForConnectedAndDeflectorHealthy

      public void waitForConnectedAndDeflectorHealthy(long timeout, TimeUnit unit) throws InterruptedException, TimeoutException
      Blocks until the Elasticsearch cluster and current write index is healthy again or the given timeout fires.
      Parameters:
      timeout - the timeout value
      unit - the timeout unit
      Throws:
      InterruptedException
      TimeoutException
    • waitForConnectedAndDeflectorHealthy

      public void waitForConnectedAndDeflectorHealthy() throws InterruptedException, TimeoutException
      Blocks until the Elasticsearch cluster and current write index is healthy again or the default timeout fires.
      Throws:
      InterruptedException
      TimeoutException
    • clusterName

      public Optional<String> clusterName()
    • clusterHealthStats

      public Optional<ClusterHealth> clusterHealthStats()
    • elasticsearchStats

      public ElasticsearchStats elasticsearchStats()