Debug Your Infrastructure

Get Instant Solutions for Kubernetes, Databases, Docker and more

AWS CloudWatch
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Pod Stuck in CrashLoopBackOff
Database connection timeout
Docker Container won't Start
Kubernetes ingress not working
Redis connection refused
CI/CD pipeline failing

Elasticsearch ElasticsearchIndexReadOnly

An index has been set to read-only mode, possibly due to disk watermark settings.

Understanding Elasticsearch

Elasticsearch is a powerful open-source search and analytics engine designed for horizontal scalability, reliability, and real-time search capabilities. It is commonly used for log and event data analysis, full-text search, and operational intelligence. Elasticsearch is part of the Elastic Stack, which also includes tools like Kibana, Logstash, and Beats.

Symptom: Elasticsearch Index Read-Only

In Elasticsearch, an index may be set to read-only mode, which prevents any further write operations. This is often triggered by certain conditions, such as disk space issues, to protect the cluster from running out of space.

Details About the Alert

The ElasticsearchIndexReadOnly alert indicates that one or more indices have been set to read-only mode. This typically occurs when Elasticsearch detects that the disk usage has exceeded the high watermark threshold. This is a protective measure to prevent the node from running out of disk space, which could lead to data loss or corruption.

Elasticsearch uses three watermark levels to manage disk space:

  • Low Watermark: When disk usage exceeds this level, Elasticsearch stops allocating new shards to the node.
  • High Watermark: When disk usage exceeds this level, Elasticsearch prevents any further writes to indices on the node.
  • Flood Stage Watermark: When disk usage exceeds this level, Elasticsearch sets all indices on the node to read-only mode.

For more details on Elasticsearch watermarks, refer to the official documentation.

Steps to Fix the Alert

Step 1: Check Disk Usage

First, verify the current disk usage on your Elasticsearch nodes. You can use the following command to check disk space:

df -h

Identify the nodes where the disk usage is high and determine if there is any unnecessary data that can be removed or archived.

Step 2: Increase Disk Space

If possible, increase the disk space on the affected nodes. This can be done by adding more storage to the existing nodes or by adding new nodes to the cluster.

Step 3: Adjust Watermark Settings

Consider adjusting the watermark settings to better suit your environment. You can update these settings using the following commands:

PUT _cluster/settings
{
"persistent": {
"cluster.routing.allocation.disk.watermark.low": "85%",
"cluster.routing.allocation.disk.watermark.high": "90%",
"cluster.routing.allocation.disk.watermark.flood_stage": "95%"
}
}

Adjust the percentage values according to your needs. For more information, visit the Elasticsearch disk watermark settings documentation.

Step 4: Change Index Back to Read-Write Mode

Once the disk space issue is resolved, change the affected indices back to read-write mode using the following command:

PUT /your_index/_settings
{
"index.blocks.read_only_allow_delete": null
}

Replace your_index with the name of the index you want to modify. This command will remove the read-only block and allow write operations to resume.

Conclusion

By following these steps, you can effectively resolve the ElasticsearchIndexReadOnly alert and ensure your Elasticsearch cluster continues to operate smoothly. Regular monitoring and proactive disk space management are crucial to prevent such issues in the future. For more tips on managing Elasticsearch, check out the Elasticsearch Reference Guide.

Master 

Elasticsearch ElasticsearchIndexReadOnly

 debugging in Minutes

— Grab the Ultimate Cheatsheet

(Perfect for DevOps & SREs)

Most-used commands
Real-world configs/examples
Handy troubleshooting shortcuts
Your email is safe with us. No spam, ever.

Thankyou for your submission

We have sent the cheatsheet on your email!
Oops! Something went wrong while submitting the form.

Elasticsearch ElasticsearchIndexReadOnly

Cheatsheet

(Perfect for DevOps & SREs)

Most-used commands
Your email is safe thing.

Thankyou for your submission

We have sent the cheatsheet on your email!
Oops! Something went wrong while submitting the form.

MORE ISSUES

Deep Sea Tech Inc. — Made with ❤️ in Bangalore & San Francisco 🏢

Doctor Droid