elasticsearch.yml 集群配置文件参数

来源:互联网 发布:淘宝上传图片不清楚 编辑:程序博客网 时间:2024/06/01 23:49

5.1 版本请使用默认的配置文件逐一添加修改设置,切勿直接复制2.X配置文件

2.x 版本的诸多配置项在5.1版本中均无法使用

更多详细参数请参考官方文档

https://www.elastic.co/guide/en/elasticsearch/reference/current/modules.html


elasticsearch 2.X 集群配置参数示例:

主节点 [host区域]:

[es@ ~]$  cat elasticsearch.yml |egrep -v "^$|^#"cluster.name: elastics   #定义集群名称所有节点统一配置node.name: es-0   # 节点名称自定义node.master: true  # 主节点,数据节点设置为 falsenode.data: false   # 数据节点设置为truepath.data: /home/es/data   path.logs: /home/es/logs   bootstrap.mlockall: true        #启动时锁定内存network.publish_host: es-0network.bind_host: es-0http.port: 9200discovery.zen.ping.multicast.enabled: falsediscovery.zen.ping_timeout: 120sdiscovery.zen.minimum_master_nodes: 2 #至少要发现集群可做master的节点数,client.transport.ping_timeout: 60sdiscovery.zen.ping.unicast.hosts: ["es-0","es-1", "es-2","es-7","es-8","es-4","es-5","es-6"] discovery.zen.fd.ping_timeout: 120sdiscovery.zen.fd.ping_retries: 6discovery.zen.fd.ping_interval: 30scluster.routing.allocation.disk.watermark.low: 100GBcluster.routing.allocation.disk.watermark.high: 50GBnode.zone: hot                     #磁盘区域,分为hot和stale,做冷热分离script.inline: truescript.indexed: true cluster.routing.allocation.same_shard.host: truethreadpool.bulk.type: fixed  threadpool.bulk.size: 32 threadpool.bulk.queue_size: 100threadpool.search.type: fixed  threadpool.search.size: 49 threadpool.search.queue_size: 10000script.engine.groovy.inline.aggs: onindex.search.slowlog.threshold.query.warn: 20sindex.search.slowlog.threshold.query.info: 10sindex.search.slowlog.threshold.query.debug: 4sindex.search.slowlog.threshold.query.trace: 1sindex.search.slowlog.threshold.fetch.warn: 2sindex.search.slowlog.threshold.fetch.info: 1600msindex.search.slowlog.threshold.fetch.debug: 500msindex.search.slowlog.threshold.fetch.trace: 200msindex.indexing.slowlog.threshold.index.warn: 20sindex.indexing.slowlog.threshold.index.info: 10sindex.indexing.slowlog.threshold.index.debug: 4sindex.indexing.slowlog.threshold.index.trace: 1sindices.fielddata.cache.size: 20%indices.fielddata.cache.expire: "48h"indices.cache.filter.size: 10%index.search.slowlog.level: WARN

数据节点 [stale区域]

[es@ ~]$  cat elasticsearch.yml |egrep -v '^$|^#'cluster.name: elastics  #集群名字node.name: es-1     #节点名称node.master: false      #不作为主节点,只存储数据node.data: true         #  做为数据节点path.data: /data1/es-data,/data2/es-data,/data3/es-data  #存储目录,可配置多个磁盘path.logs: /opt/es/logs     #日志目录bootstrap.mlockall: true    #启动时锁定内存network.publish_host: es-1  #绑定网卡network.bind_host: es-1     #绑定网卡http.port: 9200             #http端口discovery.zen.ping.multicast.enabled: false       #禁用多播,夸网段不能用多播discovery.zen.ping_timeout: 120s                  discovery.zen.minimum_master_nodes: 2             #至少要发现集群可做master的节点数client.transport.ping_timeout: 60sdiscovery.zen.ping.unicast.hosts: ["es-0","es-1", "es-2","es-7","es-8","es-4","es-5","es-6"]     # 集群自动发现# fd 是 fault detection # discovery.zen.ping_timeout 仅在加入或者选举 master 主节点的时候才起作用;# discovery.zen.fd.ping_timeout 在稳定运行的集群中,master检测所有节点,以及节点检测 master是否畅通时长期有用discovery.zen.fd.ping_timeout: 120s                # 超时时间(根据实际情况调整)discovery.zen.fd.ping_retries: 6                   # 重试次数,防止GC[垃圾回收]节点不响应被剔除discovery.zen.fd.ping_interval: 30s                # 运行间隔#控制磁盘使用的低水位。默认为85%,意味着如果节点磁盘使用超过85%,则ES不允许在分配新的分片。当配置具体的大小如100MB时,表示如果磁盘空间小于100MB不允许分配分片cluster.routing.allocation.disk.watermark.low: 100GB      #磁盘限额#控制磁盘使用的高水位。默认为90%,意味着如果磁盘空间使用高于90%时,ES将尝试分配分片到其他节点。上述两个配置可以使用API动态更新,ES每隔30s获取一次磁盘的使用信息,该值可以通过cluster.info.update.interval来设置cluster.routing.allocation.disk.watermark.high: 50GB      #磁盘最低限额node.zone: stale                      #磁盘区域,分为hot和stale,做冷热分离script.inline: true                   #支持脚本script.indexed: true cluster.routing.allocation.same_shard.host: true    #一台机器部署多个节点时防止一个分配到一台机器上,宕机导致丢失数据threadpool.bulk.type: fixed    #以下6行为设置thread_poolthreadpool.bulk.size: 32 threadpool.bulk.queue_size: 100threadpool.search.type: fixed  threadpool.search.size: 49 threadpool.search.queue_size: 10000script.engine.groovy.inline.aggs: onindex.search.slowlog.threshold.query.warn: 20s    #以下为配置慢查询和慢索引的时间index.search.slowlog.threshold.query.info: 10sindex.search.slowlog.threshold.query.debug: 4sindex.search.slowlog.threshold.query.trace: 1sindex.search.slowlog.threshold.fetch.warn: 2sindex.search.slowlog.threshold.fetch.info: 1600msindex.search.slowlog.threshold.fetch.debug: 500msindex.search.slowlog.threshold.fetch.trace: 200msindex.indexing.slowlog.threshold.index.warn: 20sindex.indexing.slowlog.threshold.index.info: 10sindex.indexing.slowlog.threshold.index.debug: 4sindex.indexing.slowlog.threshold.index.trace: 1s

数据节点1:

[es@ ~]$  cat elasticsearch.yml |egrep -v '^$|^#'cluster.name: elasticsnode.name: node-7node.master: falsenode.data: truepath.data: /data/es-data,/data1/es-data,/data2/es-datapath.logs: /opt/es/logsbootstrap.mlockall: truenetwork.publish_host: es-7network.bind_host: es-7http.port: 9200discovery.zen.ping.multicast.enabled: falsediscovery.zen.ping_timeout: 120sdiscovery.zen.minimum_master_nodes: 2 client.transport.ping_timeout: 60sdiscovery.zen.ping.unicast.hosts: ["es-0","es-1", "es-2","es-7","es-8","es-4","es-5","es-6"] discovery.zen.fd.ping_timeout: 120sdiscovery.zen.fd.ping_retries: 6discovery.zen.fd.ping_interval: 30scluster.routing.allocation.disk.watermark.low: 80GBcluster.routing.allocation.disk.watermark.high: 40GBnode.zone: hotscript.inline: truescript.indexed: true cluster.routing.allocation.same_shard.host: truethreadpool.bulk.type: fixed  threadpool.bulk.size: 32 threadpool.bulk.queue_size: 100threadpool.search.type: fixed  threadpool.search.size: 49threadpool.search.queue_size: 10000script.engine.groovy.inline.aggs: onindices.fielddata.cache.size: 20%indices.fielddata.cache.expire: "48h"indices.cache.filter.size: 10%
0 0
原创粉丝点击