如何在Elasticsearch中解决unassigned_shards?

时间:2019-05-09 10:24:18

标签: elasticsearch

如何解决Elasticsearch中的unassigned_shards? 当我运行命令curl -XGET'localhost:9200 / _cluster / health?pretty' 我得到了以下结果


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

1 个答案:

答案 0 :(得分:1)

由于您的集群只有一个节点,因此总会有未分配的分片-它们是replica shards。它们用于在节点崩溃时还原数据。一旦您的群集中有两个节点,它们就会自动分配给另一个节点。如果您不想拥有它们,例如因为u在本地开发中,则可以在索引映射中将副本分片大小设置为0。您可以在Update Indices Settings documentation上查找操作方法。