The invention belongs to the field of computer technology, in particular to an Elastic search index fragmentation optimization method, which includes constructing index fragmentation quantity model, calculating reasonable index fragmentation quantity, and adjusting index parameter setting to relax the fragmentation of the same index on each node according to the load performance of Elastic search cluster node and the estimated business data volume of the index. According to the load performance of Elastic search cluster nodes, the index fragmentation distribution strategy is optimized, so that the better performance nodes place index fragmentation first; according to the load performance of nodes, a load balancing strategy is established to migrate hot spots in high load nodes, so that the load balancing of Elastic search cluster can be achieved; the method adopted by the present invention can be used to achieve load balancing of Elastic search cluster. In order to improve the performance of index fragmentation and achieve the goal of load balancing in cluster.
【技术实现步骤摘要】
一种Elasticsearch索引分片优化方法
本专利技术属于计算机
,涉及分布式全文检索系统Elasticsearch存储领域,尤其涉及一种Elasticsearch索引分片优化方法。
技术介绍
ElasticSearch是一个开源的分布式搜索引擎,它既能存储和管理大规模的非结构化数据,也能实现对其存储数据的近实时全文检索。这使得Elasticsearch近年来在业界得到广泛的部署应用,例如,百度从2013年10月开始使用ElasticSearch并覆盖其20多个业务线;Github使用Elasticsearch搜索20TB的数据,包括13亿的文件和1300亿行的代码;空客公司对交付的10,926架飞机提供其所有机型的相关文档,使用Elasticsearch在2秒内完成对20亿个文档,共6TB数据的全文搜索。对于数据暴涨并且需要对用户提供精确检索服务的企业来说,Elasticsearch为它们提供了对大数据的存储管理和全文检索功能,极大地提高了检索性能和用户体验。Elasticsearch由于其分布式存储、倒排索引以及数据分片等特性得到广泛关注。当前研究主要集中在其索引存储、数据分片处理、索引结构等方面。针对索引存储方面:郑义成等人提出了一种基于ElasticSearch分布式集群的AIS数据存储方法,该方法对AIS数据构造了索引时空立方体存储结构,从而提升时空查询效率;DequanChen,YiChen,BrianN等人提出基于HDFS和ElasticSearch日常医疗数据存储集群拓扑的优化,该方法建立两个相同Hadoop环境的大数据平台,每个 ...
【技术保护点】
1.一种Elasticsearch索引分片优化方法,其特征在于,所述方法包括以下步骤:S1、根据Elasticsearch集群节点的负载性能和索引的预估业务数据量,构建索引分片数量模型,计算出合理的索引分片数量,并调整索引的参数设置用于放宽同一索引的分片在每个节点上总数量的限制;S2、根据Elasticsearch集群节点的负载性能,对索引分片分布策略进行优化,使得性能较优的节点优先放置索引分片;S3、根据节点的负载性能,建立负载均衡策略,对高负载节点中的热点分片进行迁移,使得Elasticsearch集群负载均衡。
【技术特征摘要】
1.一种Elasticsearch索引分片优化方法,其特征在于,所述方法包括以下步骤:S1、根据Elasticsearch集群节点的负载性能和索引的预估业务数据量,构建索引分片数量模型,计算出合理的索引分片数量,并调整索引的参数设置用于放宽同一索引的分片在每个节点上总数量的限制;S2、根据Elasticsearch集群节点的负载性能,对索引分片分布策略进行优化,使得性能较优的节点优先放置索引分片;S3、根据节点的负载性能,建立负载均衡策略,对高负载节点中的热点分片进行迁移,使得Elasticsearch集群负载均衡。2.根据权利要求1所述的一种Elasticsearch索引分片优化方法,其特征在于,所述合理的索引分片数量是根据以下确定的:设置性能校验条件,对Elasticsearch集群每个节点进行性能校验;性能校验完成后采用下式计算得到索引分片数量;其中,shardNum表示索引分片数量;表示向下取整;D为索引预估业务数据量,λ为扩展系数,N表示数组长度;nodeArrl表示数组nodeArr中第l个数据;若上式得到的索引分片数量超过当前可用的节点数量,则以当前可用的节点数量设置分片数量,即采用下式计算索引分片数量同时调整索引参数total_shards_per_node:x,该参数用于限制同一索引的分片在每个节点上的总数量。3.根据权利要求2所述的一种Elasticsearch索引分片优化方法,其特征在于,所述对Elasticsearch集群每个节点进行性能校验包括校验节点磁盘使用率是否使用超过其磁盘阈值,校验节点现有索引分片数量是否超过其数量阈值,并将校验结果保存于数组nodeArr中,若两次校验各自超过其阈值,则将对应的nodeArr元素置1,否则置为0。4.根据权利要求2所述的一种Elasticsearch索引分片优化方法,其特征在于,所述索引参数total_shards_per_node的取值x通过下式计算5.根据权利要求1所述的一种Elasticsearch索引分片优化方法,其特征在于,所述步骤S2具体包括:S21:采用线性加权法对集群节点进行性能评估;S22:以步骤S1计算出的索引分片数量,对该索引分片进行分片放置,优先从性能值高的节点进行分片的放置;S23:判断是否还有剩余分片未创建,若有...
【专利技术属性】
技术研发人员:蒋溢,王章龙,熊安萍,龙林波,
申请(专利权)人:重庆邮电大学,
类型:发明
国别省市:重庆,50
还没有人留言评论。发表了对其他浏览者有用的留言会获得科技券。