ElasticSearch - 每个节点的最佳分片数 [英] ElasticSearch - Optimal number of Shards per node

查看:60
本文介绍了ElasticSearch - 每个节点的最佳分片数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果有人可以建议每个 ES 节点的最佳分片数量以获得最佳性能,或者提供任何推荐的方法来确定应该使用的分片数量,我将不胜感激,考虑到内核数量和内存占用空间.

I would appreciate if someone could suggest the optimal number of shards per ES node for optimal performance or provide any recommended way to arrive at the number of shards one should use, given the number of cores and memory foot print.

推荐答案

分片前需要考虑三个条件..

There are three condition you consider before sharding..

情况 1) 您希望使用具有故障转移和高可用性的弹性搜索.然后你去分片.在这种情况下,您需要根据要在生产中使用的节点数[ES 实例] 选择分片数.

Situation 1) You want to use elasticsearch with failover and high availability. Then you go for sharding. In this case, you need to select number of shards according to number of nodes[ES instance] you want to use in production.

考虑您想在生产中提供 3 个节点.然后你需要为每个索引选择 1 个主分片和 2 个副本.如果您选择的分片比您需要的多.

Consider you wanna give 3 nodes in production. Then you need to choose 1 primary shard and 2 replicas for every index. If you choose more shards than you need.

情况 2) 您当前的服务器将保存当前数据.但是由于未来动态数据增加,您可能最终没有磁盘空间或您的服务器无法处理大量数据,那么您需要配置更多的分片,例如 2 或 3 个分片(这取决于您的要求) 用于每个索引.但不应该有任何副本.

Situation 2) Your current server will hold the current data. But due to dynamic data increase future you may end up with no space on disk or your server cannot handle much data means, then you need to configure more no of shards like 2 or 3 shards (its up to your requirements) for each index. But there shouldn't any replica.

情况 3) 在这种情况下,您是情况 1 和情况的组合情况.2.那么你需要结合这两种配置.考虑您的数据动态增加,并且您还需要高可用性和故障转移.然后您配置一个具有 2 个分片和 1 个副本的索引.然后你可以在节点之间共享数据并获得最佳性能..!

Situation 3) In this situation you the combined situation of situation 1 & 2. then you need to combine both configuration. Consider your data increased dynamically and also you need high availability and failover. Then you configure a index with 2 shards and 1 replica. Then you can share data among nodes and get an optimal performance..!

注意: 然后查询将在每个分片中进行处理,并对所有分片的结果进行mapreduce并将结果返回给我们.所以map reduce过程是一个昂贵的过程.最小分片为我们提供最佳性能

如果您在生产中只使用一个节点,那么只有一个主分片是每个索引的最佳分片数.

If you are using only one node in production then, only one primary shards is optimal no of shards for each index.

希望它有帮助..!

这篇关于ElasticSearch - 每个节点的最佳分片数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆