The base algorithm for searches picks out one replica from each
shard in a round-robin fashion, without regard to whether it’s on 
the same machine or not.

You can alter this behavior, see: 
https://lucene.apache.org/solr/guide/8_1/distributed-requests.html

When you say “the exact same search”, it isn’t quite in the sense that
it’s going to a different shard as evidenced by &DISTRIB=false being
on the URL (I’d guess you already know that, but…). The top-level
request _may_ be forwarded as is, there’s an internal load balancer
that does this. The theory is that all the top-level requests shouldn’t
be handled by the same Solr instance if a client is directly using
the http address of a single node in the cluster for all requests.

Best,
Erick



> On May 27, 2020, at 11:12 AM, Odysci <ody...@gmail.com> wrote:
> 
> Hi,
> 
> I have a question regarding solrcloud searches on both replicas of an index.
> I have a solrcloud setup with 2 physical machines (let's call them A and
> B), and my index is divided into 2 shards, and 2 replicas, such that each
> machine has a full copy of the index. My Zookeeper setup uses 3 instances.
> The nodes and replicas are as follows:
> Machine A:
>      core_node3 / shard1_replica_n1
>      core_node7 / shard2_replica_n4
> Machine B:
>      core_node5 / shard1_replica_n2
>      core_node8 / shard2_replica_n6
> 
> I'm using solrJ and I create the solr client using Http2SolrClient.Builder
> and the IP of machineA.
> 
> Here is my question:
> when I do a search (using solrJ) and I look at the search logs on both
> machines, I see that the same search is being executed on both machines.
> But if the full index is present on both machines, wouldn't it be enough
> just to search on one of machines?
> In fact, if I turn off machine B, the search returns the correct results
> anyway.
> 
> Thanks a lot.
> 
> Reinaldo

Reply via email to