Elasticsearch health status 显示为 yellow 解决方法

Elasticsearch About 1,182 words

查看 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"

返回:

health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
yellow open megacorp Cd6ahzdvSiScOyrYRzYA9g 1 1 4 0 21.9kb 21.9kb
yellow open my_index C3BkK5ACTI2EQvjIkqXXng 1 1 7 0 12.1kb 12.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 
    } 
}'
Views: 11,400 · Posted: 2019-04-26

————        END        ————

Give me a Star, Thanks:)

https://github.com/fendoudebb/LiteNote

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

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


Today On History
Browsing Refresh