我刚打酱油去了,不好意思

logstash-output-elasticsearch,为elasticsearch创建索引怎么设置主分片?

Elasticsearch | 作者 sun199331si | 发布于2018年04月26日 | 阅读数:3225

logstash-output-elasticsearch,为elasticsearch创建索引怎么设置分片?
已邀请:

strglee

赞同来自:

logstash没有直接提供相关的配置项
有两种方案 
1. 通过template模板
 https://www.elastic.co/guide/e ... plate
template:

{
"template" : "syslog*",
"version" : 50001,
"settings" : {
"index.refresh_interval" : "5s",
"index.number_of_replicas" : 0,
"index.number_of_shards" : 1
},
...
}

logstash:

output {
elasticsearch {
hosts => ["localhost:9200"]
index => "syslog%{+YYYY.MM.dd}"
template => "path_to_your_template.json"
template_name => "syslog*"
template_overwrite => true
}
}
2. 请求接口设置
PUT /my_temp_index
{
"settings": {
"number_of_shards" : 1,
"number_of_replicas" : 0
}
}

huzhongyong

赞同来自:

很好

要回复问题请先登录注册