简体   繁体   English

Elasticsearch Marvel。主要和副本碎片

[英]Elasticsearch Marvel. Primary & Replicas Shards

With the newly released Marvel from ElasticSearch I wanted to ask the question whether we could adjust the amount of replicas it creates upon creating an index, that is every time it creates an index. 随着ElasticSearch新发布的Marvel,我想问一个问题,即我们是否可以在创建索引时调整它创建的副本数量,即每次创建索引时。 It currently creates one primary and one replica shard. 它目前创建一个主分片和一个副本分片。 Can this be adjusted permanently? 可以永久调整吗?

Thanks 谢谢

Update for Replicas 副本更新

curl -XPUT localhost:9200/_template/marvel_custom -d '
{
    "order" : 1,
    "template" : ".marvel*",
    "settings" : {
        "number_of_replicas" : 0
    }
}'

Elasticsearch Marvel by default indexes data into daily indices, similarly to what logstash does. Elasticsearch Marvel默认情况下将数据索引到每日索引中,类似于logstash所做的那样。 It first submits an index template that contains the default settings and mappings for its indices, as mentioned here . 它首先提出的指标模板 ,它包含了指数的默认设置和映射,提到这里 You can see the default index template just retrieving it by id: 您可以看到默认索引模板,只需通过id检索它:

curl -XGET localhost:9200/_template/marvel

and you can definitely change it by just submitting an updated version of it with same name, but make sure you don't change the default mappings or anything else. 你可以通过提交具有相同名称的更新版本来改变它,但请确保不要更改默认映射或其他任何内容。

In fact instead of changing the default index template, I'd suggest to add an additional one, with order higher than 0, which applies only your custom settings: 事实上,我建议不要更改默认索引模板,而是添加额外的一个,订单高于0,这仅适用于您的自定义设置:

curl -XPUT localhost:9200/_template/marvel_custom -d '
{
    "order" : 1,
    "template" : ".marvel*",
    "settings" : {
        "number_of_shards" : 5
    }
}
'

This way both templates will get applied, and the one with highest order will win when it comes to settings with same name. 这样,两个模板都将被应用,具有最高顺序的模板将在具有相同名称的设置中获胜。

shouldn't new template include index.number_of_replicas 0? 新模板不应该包含index.number_of_replicas 0吗? It seems that if it is not specified then it will fall back to default which is one 似乎如果没有指定,那么它将回退到默认值,即1

curl -XPUT localhost:9200/_template/marvel_custom
{
    "order" : 1,
    "template" : ".marvel*",
    "settings" : {
        "number_of_shards" : "5",
        "index.number_of_replicas" : "0"
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM