Wednesday, February 8, 2017

Elastic search Cluster: Identify Masternode

Use the following queries to identify the master node in an Elasticsearch cluster

There are many ways to identify the master node

Method1:

curl -XGET 'http://localhost:9200/_cat/nodes?pretty=true'

The entry of master node will be denoted by *

xyz.local 100.72.76.15 50 65 0.87 d * xyz

Method2:


1. Get the logical ID of the master node

curl -XGET 'http://localhost:9200/_cluster/state/master_node?pretty=true'

{
  "cluster_name" : "xxxxxx",
  "master_node" : "<Logical ID of master node>"
}

2. From the logical ID of the master_node obtained in step 1, identify the host

curl -XGET 'http://localhost:9200/_nodes/<logical ID of master node>/name?pretty=true'

{
  "cluster_name" : "xxxxxx",
  "nodes" : {
    "<Logical ID of master node" : {
      "name" : "<server_name>",
      "transport_address" : "inet[/100.72.76.19:9300]",
      "host" : "<server FQDN>",
      "ip" : "100.72.76.15",
      "version" : "1.7.1",
      "build" : "b88f43f",
      "http_address" : "inet[/100.72.76.19:9200]"
    }
  }
}

No comments:

Post a Comment