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 ' { "index" : { "number_of_replicas" : 0 } }'

    如果要所有的配置都生效,修改配置文件:

    index.number_of_shards: 3
    index.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
        }
    }
    '

  • 相关阅读:
    文件系统类型
    Linux VFS分析(二)
    VFS(Virtual File System)
    shell语言
    linux VFS 之一 :虚拟文件系统的面向对象设计思想
    分层利器 facade
    微内核与面向组件
    从操作系统内核看设计模式--linux内核的facade模式
    软件架构模式
    联系的度量
  • 原文地址:https://www.cnblogs.com/mikeluwen/p/8031813.html
Copyright © 2011-2022 走看看