博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
8.5. 集群管理
阅读量:6867 次
发布时间:2019-06-26

本文共 5558 字,大约阅读时间需要 18 分钟。

查看节点信息

root@netkiller /var/log/elasticsearch % curl -XGET localhost:9200/{  "name" : "node-1",  "cluster_name" : "elasticsearch",  "cluster_uuid" : "I7jirJ2yTr-f2qrBNorQYA",  "version" : {    "number" : "5.6.0",    "build_hash" : "781a835",    "build_date" : "2017-09-07T03:09:58.087Z",    "build_snapshot" : false,    "lucene_version" : "6.6.0"  },  "tagline" : "You Know, for Search"}

8.5.1. 节点健康状态

root@netkiller ~ % curl 'http://localhost:9200/_cat/health?v' epoch      timestamp cluster        status node.total node.data shards pri relo init unassign pending_tasks max_task_wait_time active_shards_percent1502445967 18:06:07  my-application yellow          2         2     17  11    0    0        5             0                  -                 77.3%
root@netkiller ~ % curl 'http://localhost:9200/_cluster/health'  {"cluster_name":"my-application","status":"yellow","timed_out":false,"number_of_nodes":2,"number_of_data_nodes":2,"active_primary_shards":11,"active_shards":17,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":5,"delayed_unassigned_shards":0,"number_of_pending_tasks":0,"number_of_in_flight_fetch":0,"task_max_waiting_in_queue_millis":0,"active_shards_percent_as_number":77.27272727272727}

8.5.2. 节点http状态

root@netkiller ~ % curl 'localhost:9200/_nodes/stats/http?pretty'{  "_nodes" : {    "total" : 2,    "successful" : 2,    "failed" : 0  },  "cluster_name" : "my-application",  "nodes" : {    "-lnKCmBXRpiwExLns0jc9g" : {      "timestamp" : 1502446878773,      "name" : "node-1",      "transport_address" : "10.104.3.2:9300",      "host" : "10.104.3.2",      "ip" : "10.104.3.2:9300",      "roles" : [        "master",        "data",        "ingest"      ],      "http" : {        "current_open" : 4,        "total_opened" : 29      }    },    "WVsgYi2HT8GWnZU1kUwFwA" : {      "timestamp" : 1502446878782,      "name" : "node-2",      "transport_address" : "10.186.7.221:9300",      "host" : "10.186.7.221",      "ip" : "10.186.7.221:9300",      "roles" : [        "master",        "data",        "ingest"      ],      "http" : {        "current_open" : 0,        "total_opened" : 2      }    }  }}

8.5.3. 查看master节点

root@netkiller ~ % curl 'http://localhost:9200/_cat/nodes?v'      ip           heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name10.104.3.2             31          98  50    0.20    0.55     0.61 mdi       -      node-110.186.7.221           25          99   0    0.00    0.01     0.05 mdi       *      node-2

8.5.4. 查看索引的节点分布

root@netkiller ~ % curl 'http://localhost:9200/_cat/shards?v'index        shard prirep state      docs   store ip           nodelogstash-api 1     p      STARTED     103   342kb 10.186.7.221 node-2logstash-api 1     r      STARTED     103   342kb 10.104.3.2   node-1logstash-api 3     p      STARTED     104 404.1kb 10.186.7.221 node-2logstash-api 3     r      STARTED     104 404.1kb 10.104.3.2   node-1logstash-api 4     p      STARTED     117 349.2kb 10.186.7.221 node-2logstash-api 4     r      STARTED     117 349.2kb 10.104.3.2   node-1logstash-api 2     p      STARTED     113 405.8kb 10.186.7.221 node-2logstash-api 2     r      STARTED     113 405.8kb 10.104.3.2   node-1logstash-api 0     p      STARTED     128 488.4kb 10.186.7.221 node-2logstash-api 0     r      STARTED     128 488.4kb 10.104.3.2   node-1.kibana      0     p      STARTED       5  31.2kb 10.186.7.221 node-2.kibana      0     r      STARTED       5  31.2kb 10.104.3.2   node-1information  1     p      STARTED      10 122.3kb 10.104.3.2   node-1information  1     r      UNASSIGNED                           information  3     p      STARTED       7 159.6kb 10.104.3.2   node-1information  3     r      UNASSIGNED                           information  4     p      STARTED       8  86.1kb 10.104.3.2   node-1information  4     r      UNASSIGNED                           information  2     p      STARTED      11   160kb 10.104.3.2   node-1information  2     r      UNASSIGNED                           information  0     p      STARTED       9 202.8kb 10.104.3.2   node-1information  0     r      UNASSIGNED

8.5.5. 索引的开启与关闭

POST /{index}/_close		关闭索引POST /{index}/_open		打开索引

8.5.5.1. _open

root@netkiller /var/log/elasticsearch % curl 'http://localhost:9200/_cat/indices?v'   health status index           uuid                   pri rep docs.count docs.deleted store.size pri.store.size       close  information     oygxIi-dR1eB9NoIZtJrxQ                                                          green  open   logstash-spring 9xXtt_L0QvKHibXFH5gjJQ   5   1       4622            0     62.9mb         31.4mbgreen  open   .kibana         9jBBaOomTO2EakZlZqnE-g   1   1         10            0     36.6kb         18.3kb
root@netkiller /var/log/elasticsearch % curl -XPOST 'http://localhost:9200/information/_open'{"acknowledged":true}#
root@netkiller /var/log/elasticsearch % curl 'http://localhost:9200/_cat/indices?v'         health status index           uuid                   pri rep docs.count docs.deleted store.size pri.store.sizegreen  open   information     oygxIi-dR1eB9NoIZtJrxQ   5   1       2417            5     34.5mb         17.3mbgreen  open   logstash-spring 9xXtt_L0QvKHibXFH5gjJQ   5   1       4622            0     62.9mb         31.4mbgreen  open   .kibana         9jBBaOomTO2EakZlZqnE-g   1   1         10            0     36.6kb         18.3kb

8.5.5.2. _close

root@netkiller /var/log/elasticsearch % curl -XPOST 'http://localhost:9200/information/_close'{"acknowledged":true}#

原文出处:Netkiller 系列 手札
本文作者:陈景峯
转载请与作者联系,同时请务必标明文章原始出处和作者信息及本声明。

你可能感兴趣的文章
Linux系统下文件类型解析
查看>>
Nginx做tomcat代理
查看>>
.NET开发者常会忽略的几个错误
查看>>
方便适用的企业监控之---CactiEZ 0.6
查看>>
haproxy实现均衡负载(linux)
查看>>
分治思想实现求连续子数组的最大和
查看>>
TypeScript学习(三)—— 类
查看>>
高并发场景下缓存处理的一些思路
查看>>
4.9k Star 安卓面试知识点,请收下!
查看>>
学习springBoot(5)log4j2日志框架整合
查看>>
何以回首所来径
查看>>
React中的url参数——this.props.match
查看>>
再有人问你volatile是什么,就把这篇文章发给他
查看>>
AngularJS学习日记(三)指令
查看>>
智能合约-Solidity官方文档(1)
查看>>
直播中需要了解的AAC基础知识
查看>>
开源电子书项目FBReader初探(一)
查看>>
Scala元编程:实现lombok.Data
查看>>
Swift 与 JavaScript 的交互(通过 JavaScriotCore)
查看>>
《编写可维护的JavaScript》读书笔记
查看>>