Es provides various useful info under /_cat/ namespaces like that:
~ᛯ curl localhost:9200/_cat/nodes
dev14.non.3dart.com 127.0.0.1 47 42 2.04 d m dev14 [ ex-cluste ]
dev13.non.3dart.com 127.0.0.1 71 48 0.77 d m dev13 [ ex-cluste ]
dev09.non.3dart.com 127.0.0.1 57 49 1.31 d m dev09 [ ex-cluste ]
dev11.non.3dart.com 127.0.0.1 63 50 0.86 d * dev11 [ ex-cluste ]
dev10.non.3dart.com 127.0.0.1 56 47 1.08 d m dev10 [ ex-cluste ]
dev12.non.3dart.com 127.0.0.1 56 42 0.68 d m dev12 [ ex-cluste ]
Adding '?v' will add colum names + padding, like that:
~ᛯ curl localhost:9200/_cat/nodes?v
host ip heap.percent ram.percent load node.role master name
dev14.non.3dart.com 127.0.0.1 46 42 1.78 d m dev14 [ ex-cluste ]
/_cat/
- index of all cats/_cat/allocation
- disk space/shard allocation summary/_cat/shards
- list of all shards and their replicas/_cat/shards/{index}
- list of shards belonging to index/_cat/master
- master node/_cat/nodes
- all nodes/_cat/indices
- health and summary of all indices/_cat/indices/{index}
- health and summary of one indice/_cat/segments
- internal data about lucene stuff/_cat/segments/{index}
- internal data about lucene stuff/_cat/recovery
- state of recovery/_cat/recovery/{index}
- state of recovery for one index/_cat/health
- health + some basic data/_cat/pending_tasks
- tasks/_cat/aliases
- aliases/_cat/aliases/{alias}
- one alias/_cat/thread_pool
- count of active threads in pool/_cat/plugins
- installed plugins
curl -XPOST 'http://localhost:9200/_cluster/nodes/_local/_shutdown?delay=60s'
- notify cluster you are shutting down then exit after 60 seconds. instead of local you can specify nodes separated by,
, attributes likerack:2
or keywords like_master
or_all
.*
can be used too on any of those for examplera*:2*
curl -XPUT localhost:9200/_cluster/settings -H 'Content-Type: application/json' -d '{"transient":{"cluster.routing.allocation.enable": "none"}}'
- disable reallocating shards. Useful if you want to restart one of nodes without too much reshufflingcurl -XPUT localhost:9200/_cluster/settings -H 'Content-Type: application/json' -d '{"transient":{"cluster.routing.allocation.enable": "all"}}'
- re-enable reallocationcurl -XPUT localhost:9200/_cluster/settings -H 'Content-Type: application/json' -d '{"transient":{"cluster.routing.allocation.cluster_concurrent_rebalance": "6"}}'
- change concurrent rebalance limit for whole clustercurl -XPUT localhost:9200/_cluster/settings -H 'Content-Type: application/json' -d '{"transient":{"cluster.routing.allocation.node_concurrent_recoveries": 15}}'
- change concurrent recoveries on nodecurl -XPOST localhost:9200/_cluster/reroute?retry_failed
- retry failed shard reallocationscurl 'http://localhost:9200/_cat/shards?v&h=index,node,shard,prirep,state,unassigned.reason
- display reason why shard is unassignedcurl -XGET "localhost:9200/_cluster/allocation/explain"
- explain in detailscurl -XPUT localhost:9200/_cluster/settings -H 'Content-Type: application/json' -d '{"transient":{"cluster.routing.allocation.exclude._name":"node1,node2"}}'
- exclude node1 and node2 from allocation, basically a soft node decommision. also works with_ip
and_host
and with globs.curl -XPUT localhost:9200/_cluster/settings -H 'Content-Type: application/json' -d '{"transient":{"cluster.routing.allocation.exclude._name":null}}'
- remove exclude rule for node namecurl -XPUT localhost:9200/_cluster/settings -H 'Content-Type: application/json' -d '{"transient":{"cluster.*":null}}'
- wildcards work for resetting toocurl -XPOST "http://localhost:9200/syslog-2018.08.06/_forcemerge?max_num_segments=1"
- force full merge (removes deleted records) on indexcurl -XPOST localhost:9200/_cluster/reroute -H 'Content-Type: application/json' -d '{"commands":[{"move":{"index":"index-name","shard":6,"from_node":"node1","to_node":"node2"}}]}'
- force shard relocation- `curl -XPUT "localhost:9200/indexname/_settings?pretty" -H 'Content-Type: application/json' -d'{"index" : {"number_of_replicas" : 1}}'
for a in $(curl -s http://localhost:9200/_cat/shards |awk '{print $1}'|perl -ne 'if (length($_) > 20) {print $_}'|uniq|sort) ; do curl -XPUT "localhost:9200/$a/_settings?pretty" -H 'Content-Type: application/json' -d'
{
"index" : {
"number_of_replicas" : 0
}
}
' & sleep 0.4 ;done