Class CoordinationDiagnosticsService

java.lang.Object
org.elasticsearch.cluster.coordination.CoordinationDiagnosticsService
All Implemented Interfaces:
ClusterStateListener

public class CoordinationDiagnosticsService extends Object implements ClusterStateListener
This service reports the health of master stability. If we have had a master within the last 30 seconds, and that master has not changed more than 3 times in the last 30 minutes, then this will report GREEN. If we have had a master within the last 30 seconds, but that master has changed more than 3 times in the last 30 minutes (and that is confirmed by checking with the last-known master), then this will report YELLOW. If we have not had a master within the last 30 seconds, then this will report RED with one exception. That exception is when: (1) no node is elected master, (2) this node is not master eligible, (3) some node is master eligible, (4) we ask a master-eligible node to run this service, and (5) it comes back with a result that is not RED. Since this service needs to be able to run when there is no master at all, it does not depend on the dedicated health node (which requires the existence of a master).
  • Field Details

    • NODE_HAS_MASTER_LOOKUP_TIMEFRAME_SETTING

      public static final Setting<TimeValue> NODE_HAS_MASTER_LOOKUP_TIMEFRAME_SETTING
      This is the default amount of time we look back to see if we have had a master at all, before moving on with other checks
    • NO_MASTER_TRANSITIONS_THRESHOLD_SETTING

      public static final Setting<Integer> NO_MASTER_TRANSITIONS_THRESHOLD_SETTING
      This is the number of times that it is not OK to have a master go null. This many transitions or more will be reported as a problem.
    • IDENTITY_CHANGES_THRESHOLD_SETTING

      public static final Setting<Integer> IDENTITY_CHANGES_THRESHOLD_SETTING
      This is the number of times that it is not OK to have a master change identity. This many changes or more will be reported as a problem.
  • Constructor Details

  • Method Details

    • start

      public void start()
      This method completes the initialization of the CoordinationDiagnosticsService. It kicks off polling for remote master stability results on non-master-eligible nodes, and registers the service as a cluster service listener on all nodes.
    • diagnoseMasterStability

      public CoordinationDiagnosticsService.CoordinationDiagnosticsResult diagnoseMasterStability(boolean verbose)
      This method calculates the master stability as seen from this node.
      Parameters:
      verbose - If true, the result will contain a non-empty CoordinationDiagnosticsDetails if the resulting status is non-GREEN
      Returns:
      Information about the current stability of the master node, as seen from this node
    • clusterChanged

      public void clusterChanged(ClusterChangedEvent event)
      Description copied from interface: ClusterStateListener
      Called when cluster state changes.

      Cluster states are applied one-by-one which means they can be a performance bottleneck. Implementations of this method should therefore be fast, so please consider forking work into the background rather than doing everything inline.

      Specified by:
      clusterChanged in interface ClusterStateListener