简体   繁体   English

在Elasticsearch中恢复后,索引仍为红色。 如何将其变成绿色?

[英]Index is still red after recovery in Elasticsearch. How to turn it green?

I am working with ES 2.2 我正在使用ES 2.2

After an index recovery with 在索引恢复后

POST /_snapshot/s3_repository/snapshot_traces_291215/_restore
{
    "include_global_state": false
}

My index is still red red open traces_v2 3 1 我的索引仍然是红色red open traces_v2 3 1

Here is the cluster health: 这是集群运行状况:

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

I am sure the recovery was complete. 我确信恢复已经完成。 I checked it with GET /_cat/recovery?v 我用GET /_cat/recovery?v检查了它

GET /_cat/_shards?v gives me: GET /_cat/_shards?v给我:

index     shard prirep state      docs store ip node 
traces_v2 2     p      UNASSIGNED                    
traces_v2 2     r      UNASSIGNED                    
traces_v2 1     p      UNASSIGNED                    
traces_v2 1     r      UNASSIGNED                    
traces_v2 0     p      UNASSIGNED                    
traces_v2 0     r      UNASSIGNED  

Could be there any version incompatibility between a snapshot of 2.1 and ES 2.2? 2.1的快照和ES 2.2之间是否存在版本不兼容?

I forced the assignation of the primaries shards to my node by. 我强行将主碎片分配给我的节点。

GET _cluster/reroute
{
    "commands" : [ {
          "allocate" : {
              "index" : "traces_v2", 
              "shard" : "2", 
              "node" : "Killer Shrike", 
              "allow_primary" : true
          }
        }
    ]
}

But the status was still Yellow because I run ES on a single node and I had 3 replica shards. 但是状态仍然是黄色,因为我在单个节点上运行ES,并且我有3个副本分片。 And replica shards can't run on a node that already has primary shard. 并且副本分片不能在已经具有主分片的节点上运行。

So I deleted them by setting the number of replica shards by index to 0. 因此,我通过将索引的副本分片数量设置为0来删除了它们。

PUT /_settings
{
    "index" : {
        "number_of_replicas" : 0
    }
}

I hope this will help other noob people like me! 我希望这会对其他像我这样的菜鸟有所帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM