简体   繁体   English

solr/elasticsearch 搜索请求是由分片还是副本处理?

[英]solr/elasticsearch search request is handled by shards or replica?

I have designed solr/elasticsearch for searching, I have a particular question.我设计了用于搜索的 solr/elasticsearch,我有一个特定的问题。 suppose I have 10K search request/seconds.假设我有 10K 搜索请求/秒。 so where will be my search on Shards or replica.那么我将在哪里搜索碎片或副本。 I know replica is backup of shards.我知道副本是分片的备份。

if it happens on shards then how/why and if its on replica then how/why ?如果它发生在分片上,那么如何/为什么,如果它在副本上,那么如何/为什么?

Primary Shard is the original copy of data, while the replica shard is a copy of your original data.主分片是数据的原始副本,而副本分片是原始数据的副本。

While Indexing always happens on the original copy ie primary shards and then copied to replica shards, but the search can happen on any of the copy irrespective of original or copy of data.虽然索引总是发生在原始副本上,即主分片,然后复制到副本分片,但搜索可以发生在任何副本上,而不管数据的原始或副本。

Hence replicas are not only created for fault-tolerance where if you lose one copy, it can recover from copy of it, But also to improve the search performance where if one shard is overloaded (primary or replica) then search happens on the least loaded copy ie another replica.因此,副本不仅是为了容错而创建的,如果丢失了一个副本,它可以从它的副本中恢复,而且还可以提高搜索性能,如果一个分片过载(主分片或副本),则搜索发生在负载最少的地方复制即另一个副本。

Please refer to Adaptive replica selection in ES on how/why replicas improve the search latency.请参阅ES 中的自适应副本选择以了解副本如何/为什么改善搜索延迟。

Feel free to let me know if you need more information.如果您需要更多信息,请随时告诉我。

EDIT based on OP comment :基于 OP 评论的编辑

From ES 7 adaptive replica selection is by default on, so it would send to a least loaded replica but even if all shards are underutilized still it wouldn't send all search requests to primary shards to avoid overloading it.从 ES 7 开始,自适应副本选择是默认开启的,因此它会发送到负载最少的副本,但即使所有分片都未充分利用,它也不会将所有搜索请求发送到主分片以避免过载。 Also before ARS(adaptive replica selection), ES used to send these search requests on round-robin fashion to avoid overloading one shard.同样在 ARS(自适应副本选择)之前,ES 用于以循环方式发送这些搜索请求,以避免使一个分片过载。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM