(五)Cluster Health

Let’s start with a basic health check, which we can use to see how our cluster is doing. We’ll be using curl to do this but you can use any tool that allows you to make HTTP/REST calls. Let’s assume that we are still on the same node where we started Elasticsearch on and open another command shell window.html

讓咱們從基本運行情況檢查開始,咱們可使用它來查看集羣的運行狀況。咱們將使用curl來執行此操做,但您可使用任何容許您進行HTTP / REST調用的工具。假設咱們仍然在咱們啓動Elasticsearch的同一節點上打開另外一個命令shell窗口。
 
To check the cluster health, we will be using the  _cat API. You can run the command below in  Kibana’s Console by clicking "VIEW IN CONSOLE" or with  curl by clicking the "COPY AS CURL" link below and pasting it into a terminal.
要檢查羣集運行情況,咱們將使用_cat API。您能夠經過單擊「查看控制檯」或經過單擊下面的「COPY AS CURL」連接並將其粘貼到終端中,在Kibana控制檯中運行如下命令。
GET /_cat/health?v

And the response:node

epoch      timestamp cluster       status     node.total node.data  shards pri   relo  init  unassign   pending_tasks   max_task_wait_time    active_shards_percent
1475247709 17:01:49  elasticsearch green           1         1       0      0     0     0         0             0                  -                100.0%

We can see that our cluster named "elasticsearch" is up with a green status.shell

咱們能夠看到名爲「elasticsearch」的羣集處於綠色狀態。網絡

Whenever we ask for the cluster health, we either get green, yellow, or red.curl

每當咱們要求羣集健康時,咱們要麼得到綠色,黃色或紅色。elasticsearch

一、Green - everything is good (cluster is fully functional)
綠色 - 一切都很好(集羣功能齊全)
 
二、Yellow - all data is available but some replicas are not yet allocated (cluster is fully functional)
黃色 - 全部數據都可用,但還沒有分配一些副本(羣集功能齊全)
 
三、Red - some data is not available for whatever reason (cluster is partially functional)
紅色 - 某些數據因爲某種緣由不可用(羣集部分功能)
 
Note: When a cluster is red, it will continue to serve search requests from the available shards but you will likely need to fix it ASAP since there are unassigned shards.
注意:當羣集爲紅色時,它將繼續提供來自可用分片的搜索請求,但您可能須要儘快修復它,由於存在未分配的分片。
 
Also from the above response, we can see a total of 1 node and that we have 0 shards since we have no data in it yet. Note that since we are using the default cluster name (elasticsearch) and since Elasticsearch uses unicast network discovery by default to find other nodes on the same machine, it is possible that you could accidentally start up more than one node on your computer and have them all join a single cluster. In this scenario, you may see more than 1 node in the above response.
一樣從上面的響應中,咱們能夠看到總共1個節點,而且咱們有0個分片,由於咱們尚未數據。請注意,因爲咱們使用的是默認羣集名稱(elasticsearch),而且因爲Elasticsearch默認使用單播網絡發現來查找同一臺計算機上的其餘節點,所以您可能會意外啓動計算機上的多個節點並擁有它們全部人都加入一個集羣。在這種狀況下,您可能會在上面的響應中看到多個節點。
 
We can also get a list of nodes in our cluster as follows:
咱們還能夠得到羣集中的節點列表,以下所示:
GET /_cat/nodes?v

And the response:ide

ip        heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name
127.0.0.1           10           5   5    4.46                        mdi      *      PB2SGZY

Here, we can see our one node named "PB2SGZY", which is the single node that is currently in our cluster.工具

在這裏,咱們能夠看到一個名爲「PB2SGZY」的節點,它是咱們集羣中當前的單個節點。
相關文章
相關標籤/搜索