Elasticsearch获取整个集群更全面的状态 Cluster State

x33g5p2x  于2021-03-14 发布在 ElasticSearch  
字(1.3k)|赞(0)|评价(0)|浏览(533)

原文链接 : https://www.elastic.co/guide/en/elasticsearch/reference/5.0/cluster-state.html

译文链接 : http://www.apache.wiki/display/Elasticsearch/Cluster+State

贡献者 : [那伊抹微笑]

cluster state(集群状态)API 可以获取一个整个集群更全面的状态。

$ curl -XGET 'http://localhost:9200/_cluster/state'

默认情况下,该集群状态的请求被路由到 Master(主)节点,以确保最近的集群状态可以被返回。出于调试的目的,您可以去指定的本地节点通过添加 local=true 到查询字符串中获取集群状态。

Response Filters(响应过滤)

由于集群状态可以增加(取决于分片和索引的数量,映射,模版),可能需要过滤集群状态的响应,在 URL 中指定部分参数。

$ curl -XGET 'http://localhost:9200/_cluster/state/{metrics}/{indices}'
参数描述
metricscan be a comma-separated list of
versionShows the cluster state version.
master_nodeShows the elected master_node part of the response
nodesShows the nodes part of the response
routing_tableShows the routing_table part of the response. If you supply a comma separated list of indices, the returned output will only contain the indices listed.
metadataShows the metadata part of the response. If you supply a comma separated list of indices, the returned output will only contain the indices listed.
blocksShows the blocks part of the response

几个示例如下 : 

# return only metadata and routing_table data for specified indices
$ curl -XGET 'http://localhost:9200/_cluster/state/metadata,routing_table/foo,bar'

# return everything for these two indices
$ curl -XGET 'http://localhost:9200/_cluster/state/_all/foo,bar'

# Return only blocks data
$ curl -XGET 'http://localhost:9200/_cluster/state/blocks'

相关文章

微信公众号

最新文章

更多