入门客AI创业平台(我带你入门,你带我飞行)
博文笔记

LNMMP+PHP+ELK

创建时间:2016-08-16 投稿人: 浏览次数:172
curl -XPUT 127.0.0.1:9200/_snapshot/backup -d "
{
    "type":"fs",
    "settings":{"location":"/opt/elk/snapshot/"}
}"

出现unassigned shards的手工修复方法

curl -XPOST "localhost:9200/_cluster/reroute" -d "{
    "commands" : [ {
          "allocate" : {
              "index" : "logstash-ksmobile-2015.05",
              "shard" : 0,
              "node" : "0G0Gu4NNTTOtOi0LH_hdfg",
              "allow_primary" : true
          }
        }
    ]
}"

出现大量unassigned shards的批量修复方法

master=$(curl -s "http://localhost:9200/_cat/master?v" | grep -v " ip " | awk "{print $1}")
for index in $(curl  -s "http://localhost:9200/_cat/shards" | grep UNASSIGNED | awk "{print $1}" | sort | uniq); do
    for shard in $(curl  -s "http://localhost:9200/_cat/shards" | grep UNASSIGNED | grep $index | awk "{print $2}" | sort | uniq); do
        echo  $index $shard

        curl -XPOST "http://localhost:9200/_cluster/reroute" -d "{
            "commands" : [ {
                  "allocate" : {
                      "index" : ""$index"",
                      "shard" : ""$shard"",
                      "node" : ""$master"",
                      "allow_primary" : true
                  }
                }
            ]
        }"

        sleep 5
    done
done

via:http://www.wklken.me/posts/2015/05/23/elasticsearch-issues.html
via:http://keenwon.com/1393.html

声明:该文观点仅代表作者本人,入门客AI创业平台信息发布平台仅提供信息存储空间服务,如有疑问请联系rumenke@qq.com。