在centos7中因為默認的分片數為一,只有在創建索引的時候可以該片es的分片數,那么該如何自定義es的分片數呢?關鍵在于使用logstash傳遞資料到es中,相關組態檔如下:
output{
elasticsearch {
hosts => ["192.168.59.163:9200"]
index => "accesslog-%{+YYYY.MM.dd}"
}
stdout{
codec => "rubydebug"
}
我如何在logstash的組態檔直接在添加索引時就把es分片數定好呢。
uj5u.com熱心網友回復:
curl --user username:passwd -XPUT http://localhost:9200/_template/log -d '{"template": "*",
"settings": {
"number_of_shards": 5,
"number_of_replicas": "0"
}
}'
在ES上執行,設定默認模板。
template *號指任意索引,你也可以寫log* 等等。6以后的版本好像不是這個欄位了。
uj5u.com熱心網友回復:
主組態檔可以設定分片數 index.number_of_shards轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/61853.html
標籤:專題技術討論區
