Elasticsearch health status显示为yellow解决方法

Elasticsearch大约 1180 字

查看health

curl -XGET "http://localhost:9200/_cluster/health?pretty=true"

返回:

{
  "cluster_name" : "elasticsearch",
  "status" : "yellow",
  "timed_out" : false,
  "number_of_nodes" : 1,
  "number_of_data_nodes" : 1,
  "active_primary_shards" : 6,
  "active_shards" : 6,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 2,
  "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" : 75.0
}

查看索引状态

curl -XGET "http://localhost:9200/_cat/indices?v"

返回:

healthstatusindexuuidprirepdocs.countdocs.deletedstore.sizepri.store.size
yellowopenmegacorpCd6ahzdvSiScOyrYRzYA9g114021.9kb21.9kb
yellowopenmy_indexC3BkK5ACTI2EQvjIkqXXng117012.1kb12.1kb

设置所有副本(rep)个数为0

curl -XPUT "http://localhost:9200/_settings" -H 'Content-Type: application/json' -d'
{
    "index" : {
        "number_of_replicas" : 0
    }
}'

再次查看索引状态:显示为green。

设置单个副本个数为0

curl -XPUT "http://localhost:9200/my_index/_settings" -H 'Content-Type: application/json' -d'
{ 
    "index" : { 
        "number_of_replicas" : 1 
    } 
}'
阅读 1802 · 发布于 2019-04-26

————        END        ————

扫描下方二维码关注公众号和小程序↓↓↓

昵称:
随便看看换一批