内容简介:最近把公司的 Elasticsearch Cluster 加了一台 Cluster Node,準備應戰更大量的 Data Query,但是加完之後發現 Index shard 沒有很平均的分散在新的 Cluster Node … :(原本我的 Elasticsearch Cluster 有 2 台,加到第 3 台後開始不平均 …在同事強力的協助下發現如果要新增移除 Cluster Node 都必須調整 Index Shard Allocation,詳細可以參考 elastic 官方「
最近把公司的 Elasticsearch Cluster 加了一台 Cluster Node,準備應戰更大量的 Data Query,但是加完之後發現 Index shard 沒有很平均的分散在新的 Cluster Node … :(
原本我的 Elasticsearch Cluster 有 2 台,加到第 3 台後開始不平均 …
在同事強力的協助下發現如果要新增移除 Cluster Node 都必須調整 Index Shard Allocation,詳細可以參考 elastic 官方「 Cluster level shard allocation 」文件
主要影響的參數有
- cluster.routing.allocation.balance.shard 每個節點分配 shard 的權重,預設為 0.45f
- cluster.routing.allocation.balance.index 每個節點分配 index 的權重,預設為 0.55f
- cluster.routing.allocation.balance.threshold 分配優化值,數字越大越不平均,預設 1.0f
預設的 index、shard 權重大概就僅適合 2 台 Cluster 分配,所以當第三台出現的時候就開始不平均了,可以透過設定 elasticsearch.yml 用 API 來讓 index / shard balance。
以 3 台來說,每台平均分配大約就是 0.3
curl -XPUT -H 'Content-Type: application/json' http://127.0.0.1:9200/_cluster/settings -d '{
"transient" : {
"cluster.routing.allocation.balance.shard" : 0.33,
"cluster.routing.allocation.balance.index" : 0.33,
"cluster.routing.allocation.balance.threshold" : 1.0}}'
或是寫在 elasticsearch.yml
cluster: routing: allocation balance shard: 0.33 index: 0.33 threshold: 1.0
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Open Data Structures
Pat Morin / AU Press / 2013-6 / USD 29.66
Offered as an introduction to the field of data structures and algorithms, Open Data Structures covers the implementation and analysis of data structures for sequences (lists), queues, priority queues......一起来看看 《Open Data Structures》 这本书的介绍吧!