Learnitweb

Configuring Dedicated Master and Data Nodes Using Node Roles in Elasticsearch

Why Do We Need Dedicated Master Nodes?

In Elasticsearch, the master node is responsible for cluster management, not for serving search results.

The master node handles things like:

  • Creating and deleting indices
  • Assigning shards to nodes
  • Keeping track of which node has which shard
  • Managing cluster state and metadata
  • Detecting node failures and reacting to them

What the master node does not do:

  • It does not execute searches.
  • It does not store index data.
  • It does not serve documents.

Because of this, in real systems:

We want the master node to be as stable, light, and undisturbed as possible.

That is why we often configure:

  • Some nodes as dedicated data nodes
  • Some nodes as dedicated master nodes

Step 1: Understanding the Node Role Configuration

In Elasticsearch, node roles are controlled using:

node.roles

By default, if you do not set anything, a node can do everything.

Dedicated Master Node

node.roles: [ master ]

This means:

  • This node is only a master
  • It is:
    • Not a data node
    • Not an ingest node
    • Not a coordinating data holder
  • It will:
    • Never store shards
    • Never hold index data

Dedicated Data Nodes with Voting Only

node.roles: [ data, master ]
node.voting_only: true

This sounds confusing at first, so let us explain it properly.

  • In order to vote in a master election, a node must be master-eligible.
  • That is why master is still present in the role list.
  • But:
    • node.voting_only: true means: “This node can vote, but it will never be elected as master.”

What Is the Coordinating Role?

Whenever you send a request to Elasticsearch, for example:

  • A search request
  • A bulk indexing request
  • A multi-get request
  • A query that touches multiple shards

That request always goes to one node first. That node becomes the coordinator for that request.

The coordinating node is responsible for:

  • Accepting the client request.
  • Figuring out which shards and which nodes need to be involved.
  • Sending the request to all relevant shards (scatter phase).
  • Collecting partial results from all shards.
  • Merging, sorting, and combining the results (gather phase).
  • Sending the final combined response back to the client.

In simple words:

The coordinating node is the “request manager” or “traffic controller” of Elasticsearch queries.

Important points

  • Without a master, the cluster cannot manage its state.
  • Without a master, it cannot answer cluster-level questions.
  • Search and read operations can continue even when the master is down.
  • The master node is only for cluster management, not for serving data.
  • Without a master:
    • You cannot:
      • Create indices
      • Delete indices
      • Change mappings
      • Change shard allocation