ElasticSearch ClusterBlockException

The cluster is in a read-only state due to disk watermark settings being exceeded.

Understanding ElasticSearch

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

Identifying the Symptom: ClusterBlockException

When working with ElasticSearch, you might encounter the ClusterBlockException. This error typically indicates that the cluster is in a read-only state, preventing write operations. This can disrupt normal operations and hinder data ingestion processes.

What You Might Observe

Developers may notice that attempts to index new documents or update existing ones fail. The error message will often include a reference to ClusterBlockException, signaling that the cluster is blocking write operations.

Exploring the Issue: Disk Watermark Settings

The ClusterBlockException often arises when the disk watermark settings are exceeded. ElasticSearch uses disk watermarks to prevent the cluster from running out of disk space, which could lead to data loss or corruption. When the disk usage surpasses the high watermark threshold, the cluster enters a read-only mode to protect data integrity.

Understanding Disk Watermarks

ElasticSearch has three watermark settings: low, high, and flood stage. These settings are configured in the elasticsearch.yml file:

  • Low Watermark: When disk usage exceeds this level, ElasticSearch issues a warning.
  • High Watermark: At this level, ElasticSearch prevents new shards from being allocated to the node.
  • Flood Stage Watermark: When this threshold is exceeded, the cluster becomes read-only.

Steps to Resolve the ClusterBlockException

To resolve the ClusterBlockException, you need to address the disk space issue. Here are the steps to follow:

Step 1: Free Up Disk Space

Start by freeing up disk space on the affected nodes. You can delete unnecessary indices or move data to other storage solutions. Use the following command to delete an index:

DELETE /index_name

Ensure you have backups before deleting any data.

Step 2: Adjust Disk Watermark Settings

If freeing up space is not feasible, consider adjusting the disk watermark settings. Edit the elasticsearch.yml file and modify the following settings:

cluster.routing.allocation.disk.watermark.low: 85%
cluster.routing.allocation.disk.watermark.high: 90%
cluster.routing.allocation.disk.watermark.flood_stage: 95%

After making changes, restart the ElasticSearch service to apply the new settings.

Additional Resources

For more information on managing disk space and watermarks in ElasticSearch, refer to the official ElasticSearch Disk-based Shard Allocation documentation. Additionally, explore the ElasticSearch Reference Guide for comprehensive insights into configuration and management.

Master

ElasticSearch

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 whitepaper on your email!
Oops! Something went wrong while submitting the form.

ElasticSearch

Cheatsheet

(Perfect for DevOps & SREs)

Most-used commands
Your email is safe with us. No spam, ever.

Thankyou for your submission

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

MORE ISSUES

Made with ❤️ in Bangalore & San Francisco 🏢

Doctor Droid