markdown elasticsearch试图分配一个被禁用的主分片

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown elasticsearch试图分配一个被禁用的主分片相关的知识,希望对你有一定的参考价值。

Allow routing allocations:

```console
curl -XPUT localhost:9200/_cluster/settings -d '{
                "transient" : {
                    "cluster.routing.allocation.enable" : "all"
                }
        }'
```

Reallocate unassigned shards, allowing primary allocations:

```console
curl -s localhost:9200/_cat/shards | grep UNASS | while read line ; do \
  read -a fields <<<"$line" ;
  curl -XPOST -d '{ 
    "commands" : [ 
      { 
        "allocate" : {
          "index" : "'${fields[0]}'",
          "shard" : '${fields[1]}',
          "node" : "elasticsearch-'$(hostname)'",
          "allow_primary": "true"
        }
      }
    ]
  }' http://localhost:9200/_cluster/reroute?pretty ; done
```

以上是关于markdown elasticsearch试图分配一个被禁用的主分片的主要内容,如果未能解决你的问题,请参考以下文章

markdown [Mapping] #elasticsearch #snippets

markdown [索引]操作文档,索引#elasticsearch

markdown [CAT] #elasticsearch

markdown Elasticsearch备忘单

markdown elasticsearch / kibana起动

markdown 自动重启Elasticsearch