暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

25_Elasticsearch运维_集群层面优化

lin在路上 2020-07-04
707

集群层面相关的优化可以分为节点规划和参数配置两部分,其中节点规划可参考<22_Elasticsearch运维_部署规划>;本文档主要介绍参数配置。参数配置主要从索引分布、recovery的最大流量两个角度进行优化

1 索引分布

 # 值越大,集群中某一节点上的shard数目越均匀
 cluster.routing.allocation.balance.shard: "0.45f“
 
 # 值越大,意味着某一索引的shard在集群中分布越均匀
 cluster.routing.allocation.balance.index: "0.55f“
 cluster.routing.allocation.balance.threshold: "1.1f“
 cluster.routing.allocation.cluster_concurrent_rebalance: "4“
 
 #自动均衡分片负载
 cluster.routing.use_adaptive_replica_selection: true
 
 # 控制磁盘使用的低水位,默认为85%,意味着如果节点磁盘使用超过85%,则ES不允许在分配新的分片。当配置具体的大小如100MB时,表示如果磁盘空间小于100MB不允许分配分片。
 cluster.routing.allocation.disk.watermark.low: 95%
 cluster.routing.allocation.disk.watermark.high: 95%
 
 # Elasticsearch可以根据节点磁盘的使用情况来配置分片分配cluster.routing.allocation.disk.threshold_enabled: false
复制

2 recovery的最大流量

recovery 是 es 数据恢复,保持数据一致性的过程,触发条件包括:从快照备份恢复,节点加入和离开,索引的_open操作等

 #初始化数据恢复时,并发恢复线程的个数,默认为4
 cluster.routing.allocation.node_initial_primaries_recoveries: 12
 
 #添加删除节点或负载均衡时并发恢复线程的个数,默认为4
 cluster.routing.allocation.node_concurrent_recoveries: 30
 
 # 线程池设置(cache fixed) 尽量不要调整,一般默认的线程池设置就可以了
 thread_pool.index.size: 32
 thread_pool.index.queue_size: 2000
 thread_pool.bulk.size: 32
 thread_pool.bulk.queue_size: 2000
 
 搜索线程池大小
  thread_pool.search.size: 32
  
 #队列大小
 indices.fielddata.cache.size: 1gb (默认10%,可适当调小)
 indices.queries.cache.size: 1gb(默认10%,可适当调小)
 indices.memory.index_buffer_size: 15% (默认10%,会影响写入性能,写入的分片数更多,则需要更多的buffer)
 cluster.routing.allocation.disk.include_relocations: false (加快shard分配,在建索引的时候,不考虑迁移的任务)
复制




文章转载自lin在路上,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论