elasticsearch - what to do with unassigned shards

后端 未结 7 1851
别跟我提以往
别跟我提以往 2020-11-28 21:54

my cluster is with yellow status because some shards are unassigned. what to do with this?

I tried set cluster.routing.allocation.disable_allocation = false

7条回答
  •  北海茫月
    2020-11-28 22:17

    This is a common issue arising from the default index setting, in particularly, when you try to replicate on a single node. To fix this with transient cluster setting, do this:

    curl -XPUT http://localhost:9200/_settings -d '{ "number_of_replicas" :0 }'
    

    Next, enable the cluster to reallocate shards (you can always turn this on after all is said and done):

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

    Now sit back and watch the cluster clean up the unassigned replica shards. If you want this to take effect with future indices, don't forget to modify elasticsearch.yml file with the following setting and bounce the cluster:

    index.number_of_replicas: 0
    

提交回复
热议问题