Module org.elasticsearch.server
Class ShardsAvailabilityHealthIndicatorService
java.lang.Object
org.elasticsearch.cluster.routing.allocation.shards.ShardsAvailabilityHealthIndicatorService
- All Implemented Interfaces:
HealthIndicatorService
public class ShardsAvailabilityHealthIndicatorService
extends Object
implements HealthIndicatorService
This indicator reports health for shards.
Indicator will report: * RED when one or more primary shards are not available * YELLOW when one or more replica shards are not available * GREEN otherwise
Each shard needs to be available and replicated in order to guarantee high availability and prevent data loses. Shards allocated on nodes scheduled for restart (using nodes shutdown API) will not degrade this indicator health.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
class
class
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Diagnosis.Definition
static final Diagnosis.Definition
static final Diagnosis.Definition
static final Diagnosis.Definition
static final Diagnosis.Definition
static final Diagnosis.Definition
static final Map<String,
Diagnosis.Definition> static final Diagnosis.Definition
static final Map<String,
Diagnosis.Definition> static final Diagnosis.Definition
static final Map<String,
Diagnosis.Definition> static final Diagnosis.Definition
static final String
static final Diagnosis.Definition
static final Diagnosis.Definition
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
Fields inherited from interface org.elasticsearch.health.HealthIndicatorService
MAX_AFFECTED_RESOURCES_COUNT
-
Constructor Summary
ConstructorDescriptionShardsAvailabilityHealthIndicatorService
(ClusterService clusterService, AllocationService allocationService, SystemIndices systemIndices) -
Method Summary
Modifier and TypeMethodDescriptioncalculate
(boolean verbose, int maxAffectedResourcesCount, HealthInfo healthInfo) protected List<Diagnosis.Definition>
checkNodeRoleRelatedIssues
(IndexMetadata indexMetadata, List<NodeAllocationResult> nodeAllocationResults, ClusterState clusterState, ShardRouting shardRouting) Generates a list of diagnoses for common problems that keep a shard from allocating to nodes depending on their role; a very common example of such a case are data tiers.protected List<Diagnosis.Definition>
checkNodesWithRoleAtShardLimit
(IndexMetadata indexMetadata, ClusterState clusterState, List<NodeAllocationResult> nodeRoleAllocationResults, Set<DiscoveryNode> nodesWithRoles, String role) protected Optional<Diagnosis.Definition>
checkNotEnoughNodesWithRole
(List<NodeAllocationResult> nodeAllocationResults, String role) createNewStatus
(Metadata metadata) Creates a newShardsAvailabilityHealthIndicatorService.ShardAllocationStatus
that will be used to track primary and replica availability, providing the color, diagnosis, and messages about the available or unavailable shards in the cluster.protected static Predicate<NodeAllocationResult>
hasDeciderResult
(String deciderName, Decision.Type outcome) Convenience method for filtering node allocation results by decider outcomes.name()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.elasticsearch.health.HealthIndicatorService
calculate, createIndicator, isPreflight
-
Field Details
-
NAME
- See Also:
-
PRIMARY_UNASSIGNED_IMPACT_ID
- See Also:
-
READ_ONLY_PRIMARY_UNASSIGNED_IMPACT_ID
- See Also:
-
REPLICA_UNASSIGNED_IMPACT_ID
- See Also:
-
RESTORE_FROM_SNAPSHOT_ACTION_GUIDE
- See Also:
-
ACTION_RESTORE_FROM_SNAPSHOT
-
DIAGNOSE_SHARDS_ACTION_GUIDE
- See Also:
-
ACTION_CHECK_ALLOCATION_EXPLAIN_API
-
FIX_DELAYED_SHARDS_GUIDE
- See Also:
-
DIAGNOSIS_WAIT_FOR_OR_FIX_DELAYED_SHARDS
-
WAIT_FOR_INITIALIZATION_GUIDE
- See Also:
-
DIAGNOSIS_WAIT_FOR_INITIALIZATION
-
ENABLE_INDEX_ALLOCATION_GUIDE
- See Also:
-
ACTION_ENABLE_INDEX_ROUTING_ALLOCATION
-
ENABLE_CLUSTER_ALLOCATION_ACTION_GUIDE
- See Also:
-
ACTION_ENABLE_CLUSTER_ROUTING_ALLOCATION
-
ENABLE_TIER_ACTION_GUIDE
- See Also:
-
INCREASE_SHARD_LIMIT_ACTION_GUIDE
- See Also:
-
ACTION_INCREASE_SHARD_LIMIT_INDEX_SETTING
-
INCREASE_CLUSTER_SHARD_LIMIT_ACTION_GUIDE
- See Also:
-
ACTION_INCREASE_SHARD_LIMIT_CLUSTER_SETTING
-
MIGRATE_TO_TIERS_ACTION_GUIDE
- See Also:
-
ACTION_MIGRATE_TIERS_AWAY_FROM_REQUIRE_DATA
-
ACTION_MIGRATE_TIERS_AWAY_FROM_REQUIRE_DATA_LOOKUP
public static final Map<String,Diagnosis.Definition> ACTION_MIGRATE_TIERS_AWAY_FROM_REQUIRE_DATA_LOOKUP -
ACTION_MIGRATE_TIERS_AWAY_FROM_INCLUDE_DATA
-
ACTION_MIGRATE_TIERS_AWAY_FROM_INCLUDE_DATA_LOOKUP
public static final Map<String,Diagnosis.Definition> ACTION_MIGRATE_TIERS_AWAY_FROM_INCLUDE_DATA_LOOKUP -
TIER_CAPACITY_ACTION_GUIDE
- See Also:
-
ACTION_INCREASE_NODE_CAPACITY
-
ACTION_INCREASE_TIER_CAPACITY_LOOKUP
-
-
Constructor Details
-
ShardsAvailabilityHealthIndicatorService
public ShardsAvailabilityHealthIndicatorService(ClusterService clusterService, AllocationService allocationService, SystemIndices systemIndices)
-
-
Method Details
-
name
- Specified by:
name
in interfaceHealthIndicatorService
-
createNewStatus
public ShardsAvailabilityHealthIndicatorService.ShardAllocationStatus createNewStatus(Metadata metadata) Creates a newShardsAvailabilityHealthIndicatorService.ShardAllocationStatus
that will be used to track primary and replica availability, providing the color, diagnosis, and messages about the available or unavailable shards in the cluster.- Parameters:
metadata
- Metadata for the cluster- Returns:
- A new ShardAllocationStatus that has not yet been filled.
-
calculate
public HealthIndicatorResult calculate(boolean verbose, int maxAffectedResourcesCount, HealthInfo healthInfo) - Specified by:
calculate
in interfaceHealthIndicatorService
-
hasDeciderResult
protected static Predicate<NodeAllocationResult> hasDeciderResult(String deciderName, Decision.Type outcome) Convenience method for filtering node allocation results by decider outcomes.- Parameters:
deciderName
- The decider that is being checkedoutcome
- The outcome expected- Returns:
- A predicate that returns true if the decision exists and matches the expected outcome, false otherwise.
-
checkNodeRoleRelatedIssues
protected List<Diagnosis.Definition> checkNodeRoleRelatedIssues(IndexMetadata indexMetadata, List<NodeAllocationResult> nodeAllocationResults, ClusterState clusterState, ShardRouting shardRouting) Generates a list of diagnoses for common problems that keep a shard from allocating to nodes depending on their role; a very common example of such a case are data tiers.- Parameters:
indexMetadata
- Index metadata for the shard being diagnosed.nodeAllocationResults
- allocation decision results for all nodes in the cluster.clusterState
- the current cluster state.shardRouting
- the shard the nodeAllocationResults refer to- Returns:
- A list of diagnoses for the provided unassigned shard
-
checkNodesWithRoleAtShardLimit
protected List<Diagnosis.Definition> checkNodesWithRoleAtShardLimit(IndexMetadata indexMetadata, ClusterState clusterState, List<NodeAllocationResult> nodeRoleAllocationResults, Set<DiscoveryNode> nodesWithRoles, @Nullable String role) -
checkNotEnoughNodesWithRole
protected Optional<Diagnosis.Definition> checkNotEnoughNodesWithRole(List<NodeAllocationResult> nodeAllocationResults, @Nullable String role) -
getAddNodesWithRoleAction
-
getIncreaseShardLimitIndexSettingAction
-
getIncreaseShardLimitClusterSettingAction
-
getIncreaseNodeWithRoleCapacityAction
-