11

Can I use multiple nodes as cluster master?

Why should I do this? Maybe for distributing queries?

Another question: can master node be a smallest machine than data nodes? My current cluster is:

n1 - 8gb ram, 4 cpu - (x) master - ( ) data
n2 - 4gb ram, 2 cpu - ( ) master - (x) data
n3 - 4gb ram, 2 cpu - ( ) master - (x) data
n4 - 4gb ram, 2 cpu - ( ) master - (x) data
n5 - 4gb ram, 2 cpu - ( ) master - (x) data

All my queries are sent to N1, and I see in HTOP that master node is always easily and fresh CPU/RAM usage and data nodes gets most of cpu/ram usage.

user3175226
  • 3,579
  • 7
  • 28
  • 47

3 Answers3

15

Answer 1) You cannot have more than one master node.

Answer 2) Consider you have 3 nodes n1, n2 and n3 that all contain data, and currently n1 is selected as the master master node. If you query in n2 node the query will be distributed to all corresponding shards of indexes[replica shard or primary shard]. The result from each shards are combined and return back to you (see the query phase docs).

It's not necessary to distribute the query by master node. Any node data or master or non data node can act as router[Distributing search queries].

Answer 3) yes the master node can be small if the node does not contain data because it need not take care of data management.Its only work is to just route the queries to corresponding nodes and return the result to you. If the master node contains data then you should have configuration more than a data node because it has 2 jobs [data management,routing query]..

Craig van Tonder
  • 7,497
  • 18
  • 64
  • 109
BlackPOP
  • 5,657
  • 2
  • 33
  • 49
  • Doesn't http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-node.html say that you can have multiple masters? Specifically "We actively promote the use of dedicated master nodes in critical clusters to make sure that there are 3 dedicated nodes whose only role is to be master" – Jacob Gillespie Mar 25 '15 at 16:33
  • 7
    @JacobGillespie Nodes marked master:true will be 'master eligible', but only one master will be elected at a time. We currently run with 3 master:true and 30 'data only' nodes, while specifying minimum_master_nodes=2 on all nodes. – Nate Fox Apr 08 '15 at 15:41
5

You can not have multiple masters running in a cluster, BUT you can set mulltiple nodes so that they can be elected as a master, when the current master goes down.

See also the discovery.zen.minimum_master_nodes setting for more explanation. There you can also find that it's better to have 1 electable master node than 2 (you should have 1 or 3+).

worldsayshi
  • 1,788
  • 15
  • 31
zjeraar
  • 436
  • 4
  • 11
-7

Can I use multiple nodes as cluster master?

Yes, you can definitely use multiple master to avoid cluster being down in case of master node failure

Why should I do this? Maybe for distributing queries?

To avoid complete cluster failure in case master goes down though all data nodes are running fine.

Another question: can master node be a smallest machine than data nodes? My current cluster is:

Yes

Yurii
  • 4,811
  • 7
  • 32
  • 41
Prashant
  • 17
  • 1
  • 4