Elasticsearch
AWS
RED status
reroute error
troubleshooting

Elasticsearch on AWS RED and reroute not allowed

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

Understanding Elasticsearch Cluster Health: AWS RED Status and "Reroute Not Allowed"

Elasticsearch is a powerful search engine that is frequently employed for log analytics, full-text search, and other real-time applications on AWS. It organizes data into indices and helps retrieve it quickly using complex queries. In an Elasticsearch cluster, data spread across nodes should be maintained in a healthy state to ensure optimal performance. One of the most critical aspects of managing an Elasticsearch cluster on AWS is understanding and addressing cluster health issues, especially when encountering a RED status or rerouting constraints.

Cluster Health Status

Elasticsearch uses a color-coded system to represent the health of a cluster:

  • GREEN: All primary and replica shards are allocated. The cluster is fully operational and has no issues.
  • YELLOW: All primary shards are allocated, but some or all replica shards are not. This indicates reduced redundancy but the cluster is still functional.
  • RED: One or more primary shards are not allocated. This is critical as some data is not available. Immediate action is required.

Common Causes of RED Status

  1. Node Failures: If one or more nodes in the cluster become unavailable, certain shards may not be allocated, leading to a RED status.
  2. Shard Limitations: The total number of shards has exceeded the cluster's capacity, preventing Elasticsearch from properly assigning them.
  3. Networking Issues: Network partitioning between nodes can result in loss of communication, affecting shard allocation.
  4. Configuration Errors: Misconfigured settings, such as incorrect index settings or too restrictive node allocations, can prevent shard allocation.

Dealing with RED Status

When encountering a RED status in an Elasticsearch cluster on AWS, immediate diagnostic and corrective actions are essential.

Steps to Address RED Status

  • Inspect Failed Shards: Use the `_cluster/allocation/explain` endpoint to get details about unallocated shards. This reports insights on why shards are not allocated.
  • Check Node Availability: Ensure all nodes are operational. Look into AWS CloudWatch metrics to identify nodes with issues or network partitions.
  • Review Logs: Elasticsearch logs, available in AWS CloudWatch, will often provide additional context such as errors in shard allocation or connections.
  • Adjust Cluster Configuration: Increase shard limits, address uneven shard distribution, or modify index settings to fit available resources.

"Reroute Not Allowed" Error

The "reroute not allowed" error is another significant indication that the cluster cannot perform modifications necessary for reallocating shards. It often surfaces during attempts to manually reroute shards.

Possible Causes and Resolutions

  • Read-Only State: The cluster might be in a read-only state due to limited disk space. Confirm the disk usage and free up space or expand storage resources.
  • Cluster Block Settings: The cluster might have restrictive dynamic settings that prevent rerouting. Inspect and modify settings such as `cluster.routing.allocation.enable` to allow movement of shards.
  • License Restrictions: Advanced features or limitations related to licensing can also prevent rerouting. Verify license compliance and ensure features used are supported by the license level.
  • Dangling Indices: Sometimes indices that are not part of the cluster state might impede allocation processes. Use the `_cluster/state` API to examine current indices and remove or reallocate dangling indices if necessary.

Best Practices to Prevent RED Status and Reroute Errors

  • Regular Backups: Ensure routine backups using AWS services like S3. This prepares for scenarios where restoration is required.
  • Monitoring and Alerts: Utilize AWS Kibana or third-party monitoring tools to regularly check cluster health and set up alerts for YELLOW or RED status changes.
  • Scaling Considerations: Plan for scaling of the cluster based on data growth and usage patterns. Consider using AWS's managed services like OpenSearch for easier scaling.
  • Balanced Shard Allocation: Ensure that the shard allocation is balanced across nodes to prevent any single point of failure.
  • Adequate Resource Allocation: Use AWS EC2 instances that match the CPU, memory, and storage needs of your Elasticsearch workload to avoid resource bottlenecks.

Summary Table: Key Points

ConceptExplanation
Cluster Health ColorsGREEN, YELLOW, and RED indicate different levels of cluster health.
Common RED CausesNode issues, shard limits, networking, configuration errors.
Reroute Not AllowedRestrictions due to read-only state, block settings, or license issues.
Preventive MeasuresRegular backups, monitoring, balanced shard distribution, scaling.

Understanding and addressing RED status and reroute issues are vital for maintaining an effective Elasticsearch cluster on AWS. With careful monitoring and management, you can ensure your cluster remains healthy and responsive to search and data retrieval needs.


Related reading
Course
Beginner
27 lessons
10 hours
System Design Fundamentals

Build a strong foundation in designing scalable, reliable distributed systems.

View the course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

All Rights Reserved.