Elasticsearch 之 文件配置参数
测试版本
实验es版本:5.6.3
配置:config/elasticsearch.yml
# ------------------------------------ Node ------------------------------------
# 集群名称
cluster.name: estest
# 节点名称
node.name: node-1
#node.attr.rack: r1
# ----------------------------------- Paths ------------------------------------
# 数据存储路径
#path.data: /path/to/data
# 日志存储路径
#path.logs: /path/to/logs
# ----------------------------------- Memory -----------------------------------
# 锁定物理内存地址,防止es内存被交换出去
#bootstrap.memory_lock: true
# ---------------------------------- Network -----------------------------------
# 设置 IP (IPv4 or IPv6):
network.host: 0.0.0.0
# 设置 HTTP:
http.port: 9200
transport.tcp.port: 9300
# --------------------------------- Discovery ----------------------------------
# 禁用多播、配置自动发现集群节点地址 ["127.0.0.1", "[::1]"]
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["127.0.0.1:9300"]
# 一台机子最大节点数
node.max_local_storage_nodes: 2
# 该属性定义的是为了形成一个集群,防止脑裂,有主节点资格并互相连接的节点的最小数目。集群节点数小于该数目时不能形成集群
discovery.zen.minimum_master_nodes: 1
# 主节点
node.master: true
# 数据节点
node.data: true
# ---------------------------------- Gateway -----------------------------------
# 控制集群在达到多少个节点之后才会开始数据恢复,通过这个设置可以避免集群自动相互发现的初期,shard分片不全的问题,假如es集群内一共有5个节点,就可以设置为5,那么这个集群必须有5个节点启动后才会开始数据分片,如果设置为3,就有可能另外两个节点没存储数据分片
#gateway.recover_after_nodes: 3
# 初始化数据恢复的超时时间,假如gateway.recover_after_nodes参数设置为5,就是5个节点全部启动后,再过5分钟开始数据恢复
#gateway.recover_after_time: 5m
# ---------------------------------- Query -----------------------------------
indices.query.bool.max_clause_count: 10240
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true
# ---------------------------------- script -----------------------------------
# 开启script语法
script.inline: true
script.stored: true
script.file: true
#
http.cors.enabled: true
http.cors.allow-origin: "*"
# ---------------------------------- xpack ------------------------------------
action.auto_create_index: ".security*,.monitoring*,.watches,.triggered_watches,.watcher-history*,.ml*"
# 开启账号登陆
xpack.security.enabled: true
xpack.monitoring.enabled: false
xpack.graph.enabled: false
xpack.watcher.enabled: false
xpack.ml.enabled: false
# ---------------------------------- 以下参数为 选配 ------------------------------------
# 读写文件方式
index.store.type: niofs
# 缓存类型
index.cache.field.type: soft
# 禁用swap
bootstrap.mlockall: true
# 本地存储
gateway.type: local
# 4个es节点开始恢复
gateway.expected_nodes: 4
# 并发恢复分片数
cluster.routing.allocation.node_initial_primaries_recoveries:8
# 同时recovery并发数
cluster.routing.allocation.node_concurrent_recoveries:2
# 数据在节点间传输最大带宽
indices.recovery.max_bytes_per_sec: 250mb
# 同时读取数据文件流线程
indices.recovery.concurrent_streams: 8
# 节点间存活检测间隔
discovery.zen.fd.ping_interval: 10s
# 存活超时时间
discovery.zen.fd.ping_timeout: 120s
# 存活超时重试次数
discovery.zen.fd.ping_retries: 6
# 使用监控
http.cors.enabled: true
# ik分词
index.analysis.analyzer.ik.type:”ik”
# 写索引线程池类型
threadpool.index.type: fixed
# 线程池大小(建议2~3倍cpu数)
threadpool.index.size: 64
# 队列大小
threadpool.index.queue_size: 1000
# 搜索线程池大小
threadpool.search.size: 64
# 搜索线程池类型
threadpool.search.type: fixed
# 队列大小
threadpool.search.queue_size: 1000
# 取数据线程池类型
threadpool.get.type: fixed
# 取数据线程池大小
threadpool.get.size: 32
# 队列大小
threadpool.get.queue_size: 1000
# 批量请求线程池类型
threadpool.bulk.type: fixed
# 批量请求线程池大小
threadpool.bulk.size: 32
# 队列大小
threadpool.bulk.queue_size: 1000
# 刷磁盘线程池类型
threadpool.flush.type: fixed
# 刷磁盘线程池大小
threadpool.flush.size: 32
# 队列大小
threadpool.flush.queue_size: 1000
# 写磁盘类型
indices.store.throttle.type: merge
indices.store.throttle.type: none
# 写磁盘最大带宽
indices.store.throttle.max_bytes_per_sec:500mb
# 索引merge最大线程数
index.merge.scheduler.max_thread_count: 8
# 刷新translog文件阀值
index.translog.flush_threshold_size:600MB
# 并发恢复分片数
cluster.routing.allocation.node_initial_primaries_recoveries:8
# 同时recovery并发数
cluster.routing.allocation.node_concurrent_recoveries:2
配置:config/jvm.options
# 最大最小内存
-Xms1g
-Xmx1g