Elasticsearch集群优化
版本配置:
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集群优化的更多相关文章
- Elasticsearch 集群优化-尽可能全面详细
Elasticsearch 集群优化-转载参考1 基本配置 基本配置,5台配置为 24C 125G 17T 的主机,每台主机上搭建了一个elasticsearch节点. 采用的elasticsearc ...
- 第九章:Elasticsearch集群优化及相关节点配置说明
Linux系统调优: Linux调整打开文件数(重新启动生效) 在/etc/security/limits.conf在文件中增加: * soft nofile 8192 * hard nofile 2 ...
- elasticsearch集群介绍及优化【转】
elasticsearch用于构建高可用和可扩展的系统.扩展的方式可以是购买更好的服务器(纵向扩展)或者购买更多的服务器(横向扩展),Elasticsearch能从更强大的硬件中获得更好的性能,但是纵 ...
- ElasticSearch 集群 & 数据备份 & 优化
ElasticSearch 集群相关概念 ES 集群颜色状态 ①. - 红色:数据都不完整 ②. - 黄色:数据完整,但是副本有问题 ③. - 绿色:数据和副本全都没有问题 ES 集群节点类型 ①. ...
- Ubuntu 14.04中Elasticsearch集群配置
Ubuntu 14.04中Elasticsearch集群配置 前言:本文可用于elasticsearch集群搭建参考.细分为elasticsearch.yml配置和系统配置 达到的目的:各台机器配置成 ...
- Elasticsearch 集群 单服务器 超级详细教程
前言 之前了解了Elasticsearch的基本概念.将spring boot + ElasticSearch + head插件 搞通之后.紧接着对es进行下一步的探索:集群.查阅资料的过程中,找到了 ...
- Elasticsearch集群架构的部署和调优(一)
[root@es-node1 ~]# mkdir /usr/java[root@es-node1 ~]# tar zxvf jdk1.8.0_131.tar.gz -C /usr/java/ [roo ...
- Azure vm 扩展脚本自动部署Elasticsearch集群
一.完整过程比较长,我仅给出Azure vm extension script 一键部署Elasticsearch集群的安装脚本,有需要的同学,可以邮件我,我给你完整的ARM Template 如果你 ...
- ELK 性能(4) — 大规模 Elasticsearch 集群性能的最佳实践
ELK 性能(4) - 大规模 Elasticsearch 集群性能的最佳实践 介绍 集群规模 集群数:6 整体集群规模: 300 Elasticsearch 实例 141 物理服务器 4200 CP ...
随机推荐
- h5调用qq客户端
这是第一种: <a href="tencent://message/?uin=1014167202&Site=在线QQ&Menu=yes"> <i ...
- AtCoder Grand Contest 017D (AGC017D) Game on Tree 博弈
原文链接https://www.cnblogs.com/zhouzhendong/p/AGC017D.html 题目传送门 - AGC017D 题意 给定一棵 n 个节点的以节点 1 为根的树. 两个 ...
- BZOJ1856 [Scoi2010]字符串 数论
原文链接http://www.cnblogs.com/zhouzhendong/p/8084577.html 题目传送门 - BZOJ1856 题意概括 找出由n个1,m个0组成的字符串,且任意前几个 ...
- 线程有gil锁
gil锁作用: 遇到阻塞( 比如 recv() , accept() )就切换
- multiprocssing,threading,多进程多线程初识
1. multiprocessing 多进程: import multiprocessing p = multiprocessing.Process(target = func,name = &quo ...
- Number String(DP)
题目: 题意: 给你一个字符串s,s[i] = 'D'表示排列中a[i] > a[i+1],s[i] = 'I'表示排列中a[i] < a[i+1]. 比如排列 {3, 1, 2, 7, ...
- 2018 icpc 青岛网络赛 J.Press the Button
Press the Button Time Limit: 1 Second Memory Limit: 131072 KB BaoBao and DreamGrid are playing ...
- Django模板之通用模板的使用
Django模板之通用模板的使用 转载:https://code.ziqiangxuetang.com/django/django-template.html 我们做网站有一些通用的部分,比如 导航, ...
- Vagrant 管理部署 VirtualBox (推荐使用)
学习一段时间的大数据和容器技术,使用虚拟机搭建实验环境还是挺耗时耗力的. 一旦虚拟机坏掉了,还要重新开始. 最近发现了Vagrant, 简直好用上天,方便快捷,易用. 下面介绍如何在Windows中安 ...
- YOLO系列:YOLO v3解析
本文好多内容转载自 https://blog.csdn.net/leviopku/article/details/82660381 yolo_v3 提供替换backbone.要想性能牛叉,backbo ...