Ensuring master election in elastic search cluster is among desired nodes

Hi,
We have a 3 node elastic cluster running as part of our application. All the 3 are master eligible nodes. We also have mongodb cluster and our application cluster also running in the same node.
Design is, master of our application and mongodb always runs on the same node. Elastic master can be any of the 3 nodes.
There is high CPU usage when all the three (application, mongodb, elasticsearch) runs as master in same node. Particularly this is because we use BulkProcessor to index the documents in elasticsearch with concurrentRequests set as '4', elasticsearch is spawning 10 writer threads in this setup.

To reduce/distribute this CPU usage, would need to make sure that node that is running as master of our application and mongodb should not be elected as Elasticsearch master. Is there a way we can achieve this?

Thanks,
Mahudees

The elected master node in Elasticsearch does not participate in indexing unless there are changes to the cluster state as a result of this, e.g. mapping updates or shard creation or relocation, so I would expect minimal additional CPU usage due to the node being the elected master. Is the process writing to Elasticsearch distributing the load across all data nodes?

1 Like

If it's a dedicated master node, and clients aren't talking to it. But it looks like this is a small cluster where each node runs all roles.

Apologies for the delay, was out of office.
We have shards count as 3 for all the indices and replica count as 3 as-well. I believe, theoretically the writing should be happening on all the 3 nodes.

Came across the voting-only option as mentioned here, will that be helpful for this use case, to configure the ES in desired device as voting-only node. If so, is there a way this config can be applied dynamically without restarting ES?

Thanks,
Mahudees