php - Which hosts to use when connecting to Elasticsearch
We have an Elasticsearch cluster made of 3 master nodes and some data nodes.
I am trying to understand which of those need to be included in a client's hosts configuration. Specifically we're using PHP, but I do not believe that makes a difference.
What is the best set of hosts to use? Is it enough to include one master? Or is it better to include all masters, or even any/all data nodes? What is best practice?
The documentation isn't very clear on this: Elasticsearch PHP 5.x
Are there any advantages/disadvantages to different set ups?
Answer
Solution:
by default all nodes are coordinator nodes and you can send queries to them so as you mentioned you can query against Data and Master nodes but it is better to not query against Data node because they are busy with querying and fetching data from their own disk. coordinators are responsible for correlate the results from Data nodes. so you should query against Master nodes. not only one node. all of them. because if one of them is down your cluster is still up.
for big cluster with 100 nodes or cluster with heavily searched, I recommended to use dedicated coordinator node. (master: false
AND data: false
)