Cluster Health and Monitoring
Learn to monitor your cluster's health, identify issues, and use essential APIs to gain insights into its operational status.
Cluster Health and Monitoring is a free Elasticsearch & Full Text Search Systems lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Elasticsearch & Full Text Search Systems learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Why Monitor Your Cluster?
Just like a car needs regular checks, your Elasticsearch cluster needs monitoring. This ensures it's running smoothly and efficiently.
Monitoring helps you catch problems early, before they affect your users. It's crucial to:
- Prevent data loss
- Ensure high availability
- Optimize performance
- Troubleshoot issues quickly
Your First Health Check
Elasticsearch provides a powerful REST API to check its health. The _cluster/health API is your go-to for a quick overview. It tells you if your cluster is alive and well.
You'd typically make an HTTP GET request to this endpoint:
GET /_cluster/healthGreen, Yellow, Red: What They Mean
The _cluster/health API returns a status that's typically one of three colors:
- Green: All primary and replica shards are allocated. Your cluster is fully operational.
- Yellow: All primary shards are allocated, but some replica shards are not. Data is available, but you might be at risk if a node fails.
- Red: One or more primary shards are unallocated. This means some data is unavailable. Immediate action is needed!
Beyond Just the Color
The _cluster/health API provides more than just a color. It shows important metrics like:
number_of_nodes: Total nodes in the cluster.number_of_data_nodes: Nodes holding data.active_shards: Shards currently processing data.unassigned_shards: Shards that haven't been allocated to a node. These are often the cause of Yellow or Red status.
Always look for unassigned_shards if your status isn't Green.
Checking Individual Nodes
Sometimes you need to check the status of individual nodes. The _cat/nodes API gives you a compact, human-readable list of all nodes, their IP addresses, roles, and resource usage.
The ?v parameter adds column headers for easier reading:
GET /_cat/nodes?vDiving into Shards
The _cat/shards API is crucial for understanding shard allocation. It lists every shard in your cluster, its index, primary/replica status, state (e.g., STARTED, UNASSIGNED), and which node it's on.
This helps diagnose Yellow or Red statuses by showing exactly which shards are unassigned:
GET /_cat/shards?vWhy '_cat' APIs are Handy
The _cat APIs (short for 'concise and tabular') are designed for command-line use. They provide data in a plain text format, making it easy to quickly check various aspects of your cluster without parsing complex JSON.
- Human-readable output
- Fast for quick checks
- Great for scripting
- Many
_catAPIs exist (e.g.,_cat/indices,_cat/health)
Common Monitoring Scenarios
When monitoring, keep an eye on:
- Red Cluster Status: Indicates data loss or inaccessibility.
- Yellow Cluster Status: Replica shards unassigned, risk of data loss on node failure.
- High CPU/Memory Usage: A node might be overloaded.
- Disk Space: Nodes running out of disk space can cause issues.
- Unassigned Shards: Always check
_cat/shardsto understand why.
These are early warning signs that require attention.
Proactive Monitoring
While manual checks are good, for a production system, you need proactive monitoring. Tools like Kibana's Alerting, Prometheus & Grafana, or dedicated monitoring services can automatically notify you of issues.
Proactive monitoring helps you:
- Automate health checks
- Get instant notifications
- Visualize trends over time
- Integrate with incident management
Check Your Understanding
You've learned about Elasticsearch cluster health statuses. Let's test your knowledge!
Recap: Your Monitoring Toolkit
We've covered essential tools for monitoring your Elasticsearch cluster:
- The
_cluster/healthAPI gives a quick overview (Green, Yellow, Red statuses). _cat/nodeshelps you check individual node status and resources._cat/shardsis key to understanding shard allocation and diagnosing unassigned shards.
Regular monitoring and understanding these statuses are crucial for a stable and reliable Elasticsearch deployment.
Frequently asked questions
Is the “Cluster Health and Monitoring” lesson free?
Yes — the full text of “Cluster Health and Monitoring” is free to read here on the web, and the Elasticsearch & Full Text Search Systems course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Elasticsearch & Full Text Search Systems course, upgrade to CoddyKit PRO.
What will I learn in “Cluster Health and Monitoring”?
Learn to monitor your cluster's health, identify issues, and use essential APIs to gain insights into its operational status. You practise Elasticsearch & Full Text Search Systems with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Elasticsearch & Full Text Search Systems?
No prior experience is required. Elasticsearch & Full Text Search Systems on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Cluster Health and Monitoring” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Elasticsearch & Full Text Search Systems lesson?
Yes. Every Elasticsearch & Full Text Search Systems lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Sharding and Replicas Explained
- Cluster Health and Monitoring
- Node Roles and Architecture
- Shard Allocation and Rebalancing