Practical Example
Let’s consider a medium-sized Elasticsearch cluster with 5 nodes:
- 3 Master-eligible Nodes
- 2 Data Nodes
1. Define Cluster Nodes
Let’s configure a node as a master-eligible node in an Elasticsearch cluster while ensuring it does not store data or preprocess documents
node.master: true
node.data: false
node.ingest: false
2. Add Data Nodes
Let’s configure a node as a data node in an Elasticsearch cluster, where the node stores data but does not act as a master or preprocess documents
node.master: false
node.data: true
node.ingest: false
3. Update Cluster Settings
Below Elasticsearch API call disables the disk space threshold for shard allocation in the cluster. When the disk threshold is disabled, Elasticsearch will not prevent shard allocation based on the available disk space on the nodes.
PUT /_cluster/settings
{
"persistent": {
"cluster.routing.allocation.disk.threshold_enabled": false
}
}
4. Check Cluster Health
Below Elasticsearch API call retrieves the current health status of the cluster. The response includes information such as the cluster name, status (green, yellow, or red), number of nodes, number of data nodes, active and initializing shards, and more
GET /_cluster/health
5. Add Ingest Nodes
This below node configuration specifies a node that can preprocess documents (node.ingest: true) but cannot be elected as the master (node.master: false) or store data shards (node.data: false).
node.master: false
node.data: false
node.ingest: true
6. Update Index Settings
This below request sets the number of replicas for the “my_index” index to 1, meaning each primary shard will have one replica.
PUT /my_index/_settings
{
"settings": {
"number_of_replicas": 1
}
}
7. Verify Cluster State
This below request retrieves the current state of the cluster, including information about the nodes, indices, shards, and cluster settings.
GET /_cluster/state
Exploring Elasticsearch Cluster Architecture and Node Roles
Elasticsearch’s cluster architecture and node roles are fundamental to building scalable and fault-tolerant search infrastructures. A cluster comprises interconnected nodes, each serving specific roles like master, data, ingest, or coordinating-only. Understanding these components is crucial for efficient cluster management and performance.
In this article, We will learn about the Elasticsearch Cluster Architecture, Node Roles in Elasticsearch, and Practical Examples in detail.
Contact Us