版本配置:

ES版本:6.2.4

OS内存64G。

一、参数配置:

ES jvm内存31G。

vi /etc/sysctl.conf

vm.swappiness = 1

elasticsearch.yml中,设置这个:bootstrap.mlockall:true

有条件使用更好的硬盘如ssd。

如果有多块盘,每个盘mount到一个目录,data path配置多个。

二、合理的Index Mapping:

1.特殊字段:如Boolean、IP、时间等。

2.字符串:尽量使用keyword,默认的text会被analyze。keyword最大32766字节。

3.调整refresh间隔:refresh_interval: 30s,默认的1秒会导致大量segment产生,影响性能。

4.调整translog刷新机制为异步:

"index": {

"translog": {

"flush_threshold_size": "1gb",

"sync_interval": "30s",

"durability": "async"

}

}

三、缓存参数调整:

设置elasticsearch.yml中:

thread_pool.bulk.queue_size: 1024

indices.fielddata.cache.size: 1gb

indices.queries.cache.size: 1gb

indices.memory.index_buffer_size: 15% (默认10%)

indices.memory.index_buffer_size会影响写入性能,写入的分片数更多,则需要更多的buffer。

熔断circuit-breaker调整(调低):

indices.breaker.total.limit: 50%

indices.breaker.request.limit: 10%

indices.breaker.fielddata.limit: 10%

四、设置合理的分片数和副本数:

1.对于数据量较小(100GB以下)的index:一般设置3~5个shard

2.对于数据量较大(100GB以上)的index:一般把单个shard的数据量控制在20GB~40GB

3.对于30G内存的节点,shard数量最好控制在600个(即每1GB内存的shard数在20以内)

4.副本数:一般副本数为1,对数据可用性有高要求的,可以设置为2

五、段合并Segment Merge

1.通过_forcemerge API进行合并,减少segments数量,同时提高查询效率:

2.max_num_segments取值为:max_num_segments =(单个索引的大小G/分片数/2G)

六、时序数据:

1.合理按天、周、月、年去创建、关闭、删除索引。

2.索引太多时,索引预创建:每天定时任务把明天需要的索引先创建好。

3.从6.7版本开始kibana自带索引生命周期管理ILM(Indice Life Management)

七、查询写入:

1.使用批量请求bulk request。

2.尽量使用自动生成的ID。Elasticsearch自动生成的ID可以确保是唯一的,以避免版本查询。

3.尽量使用filter而不是query。使用filter不会计算评分score,只计算匹配。

4.如果不关心文档返回的顺序,则按_doc排序。

5.避免通配符查询。

6.不要获取太大的结果数据集,如果需要大量数据使用scroll API。

7.避免索引大的document数据,如超过100M的一条document。

参考:

https://cloud.tencent.com/developer/article/1357698

https://www.elastic.co/guide/en/elasticsearch/reference/6.2/general-recommendations.html

https://www.elastic.co/guide/en/elasticsearch/reference/6.2/tune-for-indexing-speed.html

https://www.elastic.co/guide/en/elasticsearch/reference/6.2/tune-for-disk-usage.html

https://www.elastic.co/guide/en/elasticsearch/reference/6.2/circuit-breaker.html

https://www.elastic.co/guide/en/elasticsearch/reference/6.2/modules-indices.html

https://www.elastic.co/blog/how-many-shards-should-i-have-in-my-elasticsearch-cluster

Elasticsearch集群优化的更多相关文章

  1. Elasticsearch 集群优化-尽可能全面详细

    Elasticsearch 集群优化-转载参考1 基本配置 基本配置,5台配置为 24C 125G 17T 的主机,每台主机上搭建了一个elasticsearch节点. 采用的elasticsearc ...

  2. 第九章:Elasticsearch集群优化及相关节点配置说明

    Linux系统调优: Linux调整打开文件数(重新启动生效) 在/etc/security/limits.conf在文件中增加: * soft nofile 8192 * hard nofile 2 ...

  3. elasticsearch集群介绍及优化【转】

    elasticsearch用于构建高可用和可扩展的系统.扩展的方式可以是购买更好的服务器(纵向扩展)或者购买更多的服务器(横向扩展),Elasticsearch能从更强大的硬件中获得更好的性能,但是纵 ...

  4. ElasticSearch 集群 & 数据备份 & 优化

    ElasticSearch 集群相关概念 ES 集群颜色状态 ①. - 红色:数据都不完整 ②. - 黄色:数据完整,但是副本有问题 ③. - 绿色:数据和副本全都没有问题 ES 集群节点类型 ①. ...

  5. Ubuntu 14.04中Elasticsearch集群配置

    Ubuntu 14.04中Elasticsearch集群配置 前言:本文可用于elasticsearch集群搭建参考.细分为elasticsearch.yml配置和系统配置 达到的目的:各台机器配置成 ...

  6. Elasticsearch 集群 单服务器 超级详细教程

    前言 之前了解了Elasticsearch的基本概念.将spring boot + ElasticSearch + head插件 搞通之后.紧接着对es进行下一步的探索:集群.查阅资料的过程中,找到了 ...

  7. Elasticsearch集群架构的部署和调优(一)

    [root@es-node1 ~]# mkdir /usr/java[root@es-node1 ~]# tar zxvf jdk1.8.0_131.tar.gz -C /usr/java/ [roo ...

  8. Azure vm 扩展脚本自动部署Elasticsearch集群

    一.完整过程比较长,我仅给出Azure vm extension script 一键部署Elasticsearch集群的安装脚本,有需要的同学,可以邮件我,我给你完整的ARM Template 如果你 ...

  9. ELK 性能(4) — 大规模 Elasticsearch 集群性能的最佳实践

    ELK 性能(4) - 大规模 Elasticsearch 集群性能的最佳实践 介绍 集群规模 集群数:6 整体集群规模: 300 Elasticsearch 实例 141 物理服务器 4200 CP ...

随机推荐

  1. 2018牛客网暑假ACM多校训练赛(第三场)I Expected Size of Random Convex Hull 计算几何,凸包,其他

    原文链接https://www.cnblogs.com/zhouzhendong/p/NowCoder-2018-Summer-Round3-I.html 题目传送门 - 2018牛客多校赛第三场 I ...

  2. String.getBytes()和String.tocharArray(),字节数组和字符数组的区别

    String.getBytes()是将字符串转化为一个字节数组.而String.toCharArray()是将一个字符串转化为一个字符数组. [例如] byte bys[] ="国庆60周年 ...

  3. ubuntu中git

    1.在ubuntu中安装git $ sudo apt-get install git git-core 2.配置本机的git $ git config --global user.name " ...

  4. Scala-Unit-2-Scala基础语法1

    一.Scala程序的开始->HelloScala 这里的操作如同java的helloworld程序,直接放代码! object HelloScala{ def main(args:Array[S ...

  5. Java字符串处理

    代码: import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s ...

  6. rem+media+jquery布局结局方案

    ; ; } ? ; + 'px'; } document.addEventListener('DOMContentLoaded', callback); window.addEventListener ...

  7. 2018 icpc 青岛网络赛 J.Press the Button

    Press the Button Time Limit: 1 Second      Memory Limit: 131072 KB BaoBao and DreamGrid are playing ...

  8. AngularJS的Scope和Digest

    Angular是一个成熟和强大的JavaScript框架.它也是一个比较庞大的框架,在熟练掌握之前,需要领会它提出的很多新概念.很多Web开发人员涌向Angular,有不少人面临同样的障碍.Diges ...

  9. python 多版本共存

    py2和3都安装结束后 接下来就是检查环境变量,缺少的我们需要添加. 在path中找以下4个变量 1.c:\Python27 2.c:\Python27\Scripts 3.c:\Python36 4 ...

  10. webpack打包之有依赖es2015模块

    一.入口文件main.js import { isDepend } from './depend.js'; import { fn } from './depend2.js'; if(isDepend ...