解決elasticsearch6.x單機版索引狀態顯示為yellow
阿新 • • 發佈:2020-09-01
索引狀態顯示為yellow的原因分析
基本的分片可用,但是備份不可用(或者是沒有備份); 這種情況Elasticsearch叢集所有的主分片已經分片了,但至少還有一個副本是缺失的。不會有資料丟失,所以搜尋結果依然是完整的。不過,你的高可用性在某種程度上被弱化。如果 更多的 分片消失,你就會丟資料了。把 yellow 想象成一個需要及時調查的警告。
解決方案
建立索引模版,指定預設的分片數及副本數,這樣在之後同樣引用該索引模版的索引將自動使用該設定,無需每次都手動設定每個索引的分片數和副本數,一勞永逸
curl --location --request PUT 'http://127.0.0.1:9200/_template/template_http_request_record' \ --header 'Authorization: Basic xxxxxxx==' \ --header 'Content-Type: application/json' \ --data-raw '{ "index_patterns": [ "record-*" ], "settings": { "number_of_shards": 1, "number_of_replicas": 0 } }'
record_*:作用於所有以record_開頭的索引
number_of_shards:分片數
number_of_replicas:副本數
最終效果
https://www.cnblogs.com/gangdou/p/10724674.html
https://www.cnblogs.com/kevingrace/p/10671063.html