我正在使用es6.1。我试图将默认的碎片数从5改为6,这在某种程度上是可能的吗?当我在elasticsearch.yaml文件中添加下面的行时,ES将不会启动。
index.number_of_replicas : 1
index.number_of_shards: 6错误如下所示:
在节点级配置上找到索引级别设置。 由于不能在节点配置(如elasticsearch.yaml )上设置ElasticSearch5.x索引级别设置,因此在系统属性或命令行arguments.In中,要升级所有索引,必须通过/${ index }/_settings API更新设置。除非所有设置都是动态的,否则为了应用将来创建的upgradeIndices,必须关闭所有索引,否则应使用索引模板设置默认值。 请执行以下操作,确保所有索引都更新了所有所需的值: curl -XPUT 'existing=true‘-d '{ "index.number_of_replicas“:"1","index.number_of_shards”:"6“}’
我的理解:
如果没有索引,或者当所有索引关闭时,可以通过以下方式更改默认值:
curl -XPUT 'http://localhost:9200/_all/_settings?preserve_existing=true' -d '{
"index.number_of_replicas" : "1",
"index.number_of_shards" : "6"
}'否则,我无法更改默认的碎片数。
我知道在创建索引之后,我不能更改碎片的数量。我可以创建这样的索引
curl -XPUT "$(hostname -I):9200/myindex/_settings?pretty" -H 'Content-Type: application/json' -d'
{
"index" : {
"number_of_shards" : 2,
"number_of_replicas" : 0
}
}
'我从Logstash向ES发送数据,并根据日期和类型自动创建索引,因此不能手动创建每个索引。
我的问题是:
发布于 2018-02-01 10:25:16
从ES5看,这里有模板,所以当您想要更改这个参数时,您必须创建自己的模板,并使用regex指定哪个索引将使用该模板。更多信息,这里。
我通过命令解决了这个问题:
PUT _template/default
{
"index_patterns": ["*"],
"order": -1,
"settings": {
"number_of_shards": "6",
"number_of_replicas": "1"
}
}现在,当我创建新索引时,它有6个碎片和1个副本。
https://stackoverflow.com/questions/48559563
复制相似问题