elasticsearch

How can I know which nodes in a cluster are actual master nodes?


I use ES 2.2.0. and have a cluster of nodes. I would like to know which node or nodes are actual master ones. How can I do that?

I tried the following ways:

curl http://my_computer:9200/_cluster/state?pretty
curl http://my_computer:9200/_nodes?pretty

and I was unable to find which node is master.


Solution

  • There is only ever one single master in a cluster, chosen among the set of master-eligible nodes.

    You can either run the /_cat/master command or the /_cat/nodes command.

    The former will yield something like this

    % curl 'localhost:9200/_cat/master?v'
    id                     ip            node
    Ntgn2DcuTjGuXlhKDUD4vA 192.168.56.30 Solarr
    

    and the latter command will yield the list of nodes with the master column (m for short). Nodes with m are master-eligible nodes and the one with the * is the current master.

    % curl 192.168.56.10:9200/_cat/nodes?v&h=id,ip,port,v,m
    id   ip            port version m
    pLSN 192.168.56.30 9300 2.2.0   m
    k0zy 192.168.56.10 9300 2.2.0   m
    6Tyi 192.168.56.20 9300 2.2.0   *