(九)elasticsearchよくある問題のまとめ

9520 ワード

1:スライス未割り当て:unassigned_sharrds
現象:GET_cluster/healthはunassigned_を見ました。sharrdsは未割り当てのスライス情報と未割り当ての原因を分析した:
curl -XGET "http://ip:port/_cat/shards?v&h=index,shard,prirep,state,node,unassigned.reason" > shards.txt
     :cat shards.txt | grep UNASSIGNED
           :curl -XGET "http://194.168.223.19:24100/_cluster/allocation/explain?pretty" -H 'Content-Type:application/json' -d '{"index":"indexName","shard":shardnum,"primary":false}'
shardnum:  GET _cat/shards?v     ,
解決の根本的な目的は未分配の原因解決を見つけて解決を分配することです。
curl -XPUT 'localhost:9200/_cluster/settings'-d
'{
      "transient":
  {
     "cluster.routing.allocation.enable" : "all" 
  }
}'
解決2:上記の方法が解決できない場合は、以下のようにしてください。
curl -XPUT "http://194.168.223.20:24100/_cluster/settings?pretty&master_timeout=180s" -H 'Content-Type:application/json' -d '{"transient":{"cluster.routing.allocation.allow_rebalance":"indices_primaries_active"}}'POST _cluster/reroute?retry_failed=trueGET _cluster/health   unassigned_shards    
2:elasticsearch exception:java.io.IOException:listener timeout after waiting for[30000]ms
分析すると、あるインデックスの要求があるサーバーに集中していることが分かります。つまり、スライスが不均衡です。
ElasticsearchException[Elasticsearch exception [type=es_rejected_execution_exception, reason=rejected execution of processing of [114475]
[indices:data/write/bulk[s][p]]: request: BulkShardRequest [[index][11]] containing [52] requests, target allocation id:sWzFdprSRRCQzyeBZGqttQ,
primary term: 1 on EsThreadPoolExecutor[name =ip/write, queue capacity = 1000, org.elasticsearch.common.util.concurrent.EsThreadPoolExecutor@d44250d
[Running, pool size = 40,active threads = 40, queued tasks = 1075, completed tasks = 44022]]]]
1:解決
1:スレッド池の状況を確認する:GET_cat/thread_pool?v拒否の多いノードを探し出します。2:大量に書いたインデックスの分割位置を確認します。GET_cat/sharrds?v書き込み中のインデックスのスライス分布が不均衡であるかどうかを探し出し、上で検索したサーバの多くが書き込み中のスライス数が多いため、50 G以上であるかどうかは書き込み速度に重大な影響を与える。3:クラスタが割り当てられていないスライスがあるかを確認して処理する。問題1:スライス割り当て最適化を行い、インデックスのsettingを設定する。主なパラメータ:total_sharrds_pernode(単一ノード上の単一のインデックスの割り当ては、スライスの最大個数を割り当てる)
put index/setting
{
     
"index" : {
     
        "mapping" : {
     
          "total_fields" : {
     
            "limit" : "2000"
          }
        },
        "refresh_interval" : "180s",
        "number_of_replicas" : "1",
        "routing" : {
     
          "allocation" : {
     
            "total_shards_per_node" : "4"
          }
        },
        "merge" : {
     
          "scheduler" : {
     
            "max_thread_count" : "1"
          },
          "policy" : {
     
            "segments_per_tier" : "20",
            "max_merge_at_once" : "20"
          }
        },
        "max_slices_per_scroll" : "5000"
      }
  }