ElasticSearch查询集群及设置
Elasticsearch查询集群API示例查看集群状态及监控参考资料https://www.elastic.co/guide/en/elasticsearch/reference/6.6/cluster-health.htmlhttps://www.elastic.co/guide/en/elasticsearch/reference/6.6/cluster-nodes-stats.html查看集群状态健康状态curl-XGET192.168.88.101:9200/_cat/health?v# 健康状态有三个状态:# Green:集群一切正常# Yellow:数据可用,副本不可用# Red:部分数据不可用,也可能有部分数据能用。curl-XGET192.168.88.101:9200/_cluster/health?pretty节点状态curl–XGET192.168.88.101:9200/_nodes/stats?pretty节点信息curl-XGET192.168.88.101:9200/_cat/nodescurl-XGET192.168.88.101:9200/_cat/nodes?vh=http,version,jdk,disk.total,disk.used,disk.avail,disk.used_percent,heap.current,heap.percent,heap.max,ram.current,ram.percent,ram.max,mastercurl-XGET192.168.88.101:9200/_nodes?pretty节点的热线程curl-XGET192.168.88.101:9200/_nodes/hot_threads查看节点进程信息curl-XGET192.168.88.101:9200/_nodes/process?prettycurl-XGET192.168.88.101:9200/_nodes/node-1/process?pretty查看所有节点jvm信息curl-XGET"192.168.88.101:9200/_nodes/stats/jvm?pretty"查看指定节点jvm信息curl-XGET"192.168.88.101:9200/_nodes/node-1/stats/jvm?pretty"查看线程curl-XGET192.168.88.101:9200/_cat/thread_pool/?vh=id,name,active,rejected,completed,size,typeprettys=type参考https://www.elastic.co/guide/en/elasticsearch/reference/6.6/cluster.htmlhttps://ops-coffee.cn/t/elasticsearch-cat-api.htmlhttps://www.elastic.co/guide/en/elasticsearch/reference/6.6/cluster-health.htmlhttps://www.elastic.co/guide/en/elasticsearch/reference/6.6/cluster-nodes-stats.htmlcat 接口查询cat api可以查看集群中的各种状态。常用curl-XGET192.168.88.101:9200/_cat/health?vcurl-XGET192.168.88.101:9200/_cat/nodescurl-XGET192.168.88.101:9200/_cat/shards|grepUNASSIGNEDcurl–XGET192.168.88.101:9200/_cat/shards?h=index,shard,prirep,state,unassigned.reason|grepUNASSIGNEDcurl-XGET192.168.88.101:9200/_cat/shards?h=index,shard,prirep,state,unassigned.reason,nodecurl-XGETh192.168.88.101:9200/_cat/pending_taskscurl-XGETh192.168.88.101:9200/_cat/tasks参考https://blog.csdn.net/wanglei_storage/article/details/82462587https://ops-coffee.cn/t/elasticsearch-cat-api.html注解aliasesGET /_cat/XXX/aliases?v GET /_cat/aliases/alias1,aliase2,aliase3查询当前配置索引,过滤器,路由的别名 如果需要指定一至多个别名,则以逗号隔开allocationGET /_cat/allocation?v查询每个节点上分配的分片(shard)的数量和每个分片(shard)所使用的硬盘容量countGET /_cat/count?v快速查询当前整个集群或者指定索引的document的数量(不包括删除的但是还没有清理掉的document)fielddataGET /_cat/fielddata?v GET /_cat/fielddata?vfields=XXX GET /_cat/fielddata/field1,field2,field3?v查询集群中每个节点中的fileddata所使用的堆内存 指定fields 指定多个fieldhealthGET /_cat/health?v GET /_cat/health?vts=false查询当前集群的健康信息(同/_cluster/health) ts用于控制是否显示时间戳(timestamp) 1、常见的用途是用于监测节点之间的健康值 2、通过循环使用该命令,用于追踪大集群恢复的时间 /_cat/health; sleep 120; done green: 每个索引的primary shard和replica shard都是active状态的 yellow: 每个索引的primary shard都是active状态的,但是部分replica shard不是active状态,处于不可用的状态 red: 不是所有索引的primary shard都是active状态的,部分索引有数据丢失了indicesGET /_cat/indices/index1?v查询指定索引index1的相关信息(组成一个索引(index)的shard数量,document的数量,删除的doc数量,主存大小和所有索引的总存储大小(包括replicas) 其中document的数量和删除document的数量是lucense层级的,包括所有隐藏的document数量 要获取Elasticsearch层级的精确的document数量可以使用 cat count或者Count APImasterGET /_cat/master?v仅用于显示master的节点ID,绑定IP地址,节点名称nodeattrsGET /_cat/nodeattrs?v输出显示自定义节点属性
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2455052.html
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!