我正在使用Logstash将日志数据发送到Elasticsearch数据库。我想从3改变碎片的数量为1,并通过ES REST API发出以下命令:Logstash一直覆盖Elasticsearch索引模板
PUT server_name/_template/logstash
{
"template": "logstash",
"settings": {
"index.number_of_replicas": "0",
"index.refresh_interval": "5s",
"index.number_of_shards": "1"
}
}
服务器responsed OK,如果我发出GET _template/logstash我可以看到,碎片的数量是现在设置为1.
然后,我开始logstash,并将输出设置为将日志传送到Elasticsearch。没有模板相关的设置。在我发送日志数据后,我发现碎片的数量已恢复为默认值(3)。
我甚至试图通过引用Logstash配置文件中的模板来覆盖它。不,不管我指定的设置是否重置。它看起来像Logstash一直覆盖Elasticsearch索引设置与一些默认值,我不知道如何禁用此。
UPDATE。我已经添加了以下行Logstash配置文件,但它并没有帮助:
manage_template => false
template_overwrite => true
也试过template_overwrite设置为false。我试图在JSON文件中设置碎片数量的两种不同的方式:
{
"logstash": {
"template": "logstash-*",
"settings": {
"index.number_of_replicas": "0",
"index.refresh_interval": "5s",
"index.number_of_shards": "1"
}
}
}
和
{
"template": "logstash-*",
"settings" : {
"index.number_of_shards" : 1,
"index.number_of_replicas" : 0,
}
}
我已经添加了以下行配置: manage_template =>假 template_overwrite =>真 但我仍然得到碎片后,我删除索引,然后重新启动Logstash的默认号码。 – 2014-09-03 13:44:46
谢谢。试过了。神秘。仍然重置。我还发布了我的JSON文件的内容。 – 2014-09-03 14:39:07
你删除了logstash- *索引? - 即'curl localhost:9200/_cat/shards | grep logstash'显示没有索引/分片?因为您无法更改已创建索引中的分片数量。 – Alcanzar 2014-09-03 15:03:58