zoukankan      html  css  js  c++  java
  • es number_of_shards和number_of_replicas

    number_of_replicas 是数据备份数,如果只有一台机器,设置为0

    number_of_shards  是数据分片数,默认为5,有时候设置为3

    可以在线改所有配置的参数,number_of_shards不可以在线改

    curl -XPUT '10.0.120.39:9200/_settings' -d ' {"number_of_replicas" : 0} '

    如果每次生成索引的时候没生效,就要注意是否有索引模板了,索引模板生成的时候已经制定了参数

    上面命令在elasticsearch 6.x 用不了了,修改如下:

    复制代码
    curl -X PUT "10.10.10.10:9200/filebeat*/_settings" -H 'Content-Type: application/json' -d'
    {
        "index" : {
            "number_of_replicas" : 0
        }
    }
    '
    复制代码

     要对后面新的index有效,要创建一个默认模板(模板很重要,模板可以为所欲为):

    复制代码
    curl -X PUT "10.10.10.10:9200/_template/template_log" -H 'Content-Type: application/json' -d'
    {
        "index_patterns" : ["filebeat*"],
        "order" : 0,
        "settings" : {
            "number_of_replicas" : 0
        }
    }
    '
    复制代码
  • 相关阅读:
    python 数据类型
    python核心语法
    python 基础知识
    format 用法
    有关python 函数参数
    模拟,队列与堆栈
    字符编码
    [LeetCode] Set Matrix Zeroes
    [LeetCode] Rotate Image
    [LeetCode] Unique Paths
  • 原文地址:https://www.cnblogs.com/cheyunhua/p/14148048.html
Copyright © 2011-2022 走看看