What is Master Node in Elasticsearch: Role and Usage Explained
master node is a special node responsible for managing the cluster's overall health and operations like creating or deleting indexes. It coordinates tasks such as node membership and cluster state updates to keep the system stable and organized.How It Works
Think of the master node as the team leader in a group project. It doesn't handle the actual work of storing or searching data but makes sure everyone knows their role and the project runs smoothly. It keeps track of which nodes are part of the cluster and manages changes like adding or removing nodes.
When you start an Elasticsearch cluster, one node is elected as the master node. This node controls important decisions like creating or deleting indexes, tracking cluster health, and distributing tasks. If the master node fails, the cluster quickly elects a new master to keep things running without interruption.
Example
This example shows how to check which node is the current master node using Elasticsearch's REST API.
GET /_cat/master?v=trueWhen to Use
You rely on the master node whenever you need to manage the cluster's structure or health. For example, when adding new nodes to increase capacity, creating or deleting indexes, or monitoring cluster status, the master node coordinates these actions.
In real-world use, if you run a large Elasticsearch cluster, you often set up dedicated master nodes that only handle cluster management. This keeps the cluster stable and prevents heavy data tasks from slowing down important control operations.
Key Points
- The master node manages cluster-wide operations and state.
- It does not store data or handle search queries directly.
- Only one master node is active at a time, elected by the cluster.
- Dedicated master nodes improve cluster stability in large setups.