首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Elasticsearch设置默认副本数为0

Elasticsearch设置默认副本数为0
EN

Stack Overflow用户
提问于 2019-09-16 20:51:10
回答 1查看 3.1K关注 0票数 1

对于没有模板创建的所有新索引,我需要将index.number_of_replicas设置为0。

这不能再通过elasticsearch.yml来完成。建议的方法是使用模板,但是我正在寻找一种不使用模板的方法。

感谢您的帮助:)

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-09-16 21:38:21

我知道的唯一方法是使用索引模板。

请注意,可以有任意多个index templates,而不是每个索引只有一个。您可以使用order设置来控制它们的顺序(即它们如何相互覆盖):

代码语言:javascript
运行
复制
# This template is low priority and applies to all indexes:
PUT _template/template_1
{
  "index_patterns": ["*"],           <-- applies to all indexes
  "order": 0,                        <-- lowest priority
  "settings": {
    "number_of_shards": 1,
    "number_of_replicas": 0
  }
}

# This template has a higher priority and only applies to indexes foo*:
PUT _template/template_1
{
  "index_patterns": ["foo*"],        <-- only applies to foo*
  "order": 3,                        <-- higher priority
  "settings": {
    "number_of_shards": 1,
    "number_of_replicas": 1          <-- overrides the number of replicas from base template
  }
}
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57957296

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档