我有一个solr云设置,包含5个节点,5个分片和replicationFactor = 2。据我所知,当我们查询solr cloud时,请求被发送到分片领导者,然后分片领导者将请求定向到副本。因此,必须从单个副本中获取查询结果。但是当我启用调试信息查询时,我看到查询请求被发送到所有副本。以下是附加的调试信息
"debug":{
"track":{
"rid":"-collection_shard2_replica1-1521525496479-3",
"EXECUTE_QUERY":{
"http://ip:8983/solr/collection_shard2_replica2/|http://ip:8983/solr/collection_shard2_replica1/":{
"QTime":"0",
"ElapsedTime":"4",
"RequestPurpose":"GET_TOP_IDS",
"NumFound":"3882137",
"Response":"{responseHeader={zkConnected=true,status=0,QTime=0,params={df=contents,f.contents.hl.fragsize=50,distrib=false,hl=false,f.ttl.hl.snippets=1,f.kw_skl.hl.simple.post=</span>,fl=[id, score],shards.purpose=4,fsv=true,f.kw_skl.hl.snippets=1,f.ttl.hl.fragsize=0,shard.url=http://ip:8983/solr/collection_shard2_replica2/|http://ip:8983/solr/collection_shard2_replica1/,rid=-collection_shard2_replica1-1521525496479-3,f.kw_skl.hl.fragsize=0,hl.simple.pre= <span class=\"bg_yellow\">,f.kw_it.hl.alternateField=kw_it,f.kw_skl.hl.alternateField=kw_skl,defType=edismax,f.ttl.hl.simple.post=</span>,qf=contents currdesig lng ttl kw_skl kw_it,hl.highlightAlternate=false,f.contents.hl.snippets=3,hl.fl=ttl,kw_skl,kw_it,contents,wt=javabin,_=1521525657029,debug=[false, timing, track],qt=/resumesearch,f.contents.hl.simple.post=</span>,start=0,f.kw_it.hl.fragsize=0,f.kw_it.hl.simple.pre= <span class=\"bg_yellow\">,rows=10,version=2,hl.encoder=html,f.kw_it.hl.snippets=1,f.ttl.hl.alternateField=ttl,q=*:*,f.ttl.hl.simple.pre= <span class=\"bg_yellow\">,hl.simple.post=</span>,requestPurpose=GET_TOP_IDS,NOW=1521525496479,isShard=true,hl.method=postings,f.contents.hl.simple.pre= <span class=\"bg_yellow\">,f.kw_skl.hl.simple.pre= <span class=\"bg_yellow\">,f.kw_it.hl.simple.post=</span>,debugQuery=false}},response={numFound=3882137,start=0,maxScore=1.0,docs=[SolrDocument{id=82569162, score=1.0}, SolrDocument{id=82569230, score=1.0}, SolrDocument{id=82569265, score=1.0}, SolrDocument{id=82569294, score=1.0}, SolrDocument{id=82569309, score=1.0}, SolrDocument{id=82569313, score=1.0}, SolrDocument{id=82569386, score=1.0}, SolrDocument{id=35263232, score=1.0}, SolrDocument{id=35263237, score=1.0}, SolrDocument{id=35263300, score=1.0}]},sort_values={},debug={timing={time=0.0,prepare={time=0.0,query={time=0.0},facet={time=0.0},facet_module={time=0.0},mlt={time=0.0},highlight={time=0.0},stats={time=0.0},expand={time=0.0},terms={time=0.0},debug={time=0.0}},process={time=0.0,query={time=0.0},facet={time=0.0},facet_module={time=0.0},mlt={time=0.0},highlight={time=0.0},stats={time=0.0},expand={time=0.0},terms={time=0.0},debug={time=0.0}}}}}"},
"http://ip:8983/solr/collection_shard3_replica2/|http://ip:8983/solr/collection_shard3_replica1/":{
"QTime":"0",
"ElapsedTime":"5",
"RequestPurpose":"GET_TOP_IDS",
"NumFound":"3884681",
"Response":"{responseHeader={zkConnected=true,status=0,QTime=0,params={df=contents,f.contents.hl.fragsize=50,distrib=false,hl=false,f.ttl.hl.snippets=1,f.kw_skl.hl.simple.post=</span>,fl=[id, score],shards.purpose=4,fsv=true,f.kw_skl.hl.snippets=1,f.ttl.hl.fragsize=0,shard.url=http://ip:8983/solr/collection_shard3_replica2/|http://ip:8983/solr/collection_shard3_replica1/,rid=-collection_shard2_replica1-1521525496479-3,f.kw_skl.hl.fragsize=0,hl.simple.pre= <span class=\"bg_yellow\">,f.kw_it.hl.alternateField=kw_it,f.kw_skl.hl.alternateField=kw_skl,defType=edismax,f.ttl.hl.simple.post=</span>,qf=contents currdesig lng ttl kw_skl kw_it,hl.highlightAlternate=false,f.contents.hl.snippets=3,hl.fl=ttl,kw_skl,kw_it,contents,wt=javabin,_=1521525657029,debug=[false, timing, track],qt=/resumesearch,f.contents.hl.simple.post=</span>,start=0,f.kw_it.hl.fragsize=0,f.kw_it.hl.simple.pre= <span class=\"bg_yellow\">,rows=10,version=2,hl.encoder=html,f.kw_it.hl.snippets=1,f.ttl.hl.alternateField=ttl,q=*:*,f.ttl.hl.simple.pre= <span class=\"bg_yellow\">,hl.simple.post=</span>,requestPurpose=GET_TOP_IDS,NOW=1521525496479,isShard=true,hl.method=postings,f.contents.hl.simple.pre= <span class=\"bg_yellow\">,f.kw_skl.hl.simple.pre= <span class=\"bg_yellow\">,f.kw_it.hl.simple.post=</span>,debugQuery=false}},response={numFound=3884681,start=0,maxScore=1.0,docs=[SolrDocument{id=55933756, score=1.0}, SolrDocument{id=72335162, score=1.0}, SolrDocument{id=72335169, score=1.0}, SolrDocument{id=72335184, score=1.0}, SolrDocument{id=55933816, score=1.0}, SolrDocument{id=55933834, score=1.0}, SolrDocument{id=55933978, score=1.0}, SolrDocument{id=55934020, score=1.0}, SolrDocument{id=55934028, score=1.0}, SolrDocument{id=55934052, score=1.0}]},sort_values={},debug={timing={time=0.0,prepare={time=0.0,query={time=0.0},facet={time=0.0},facet_module={time=0.0},mlt={time=0.0},highlight={time=0.0},stats={time=0.0},expand={time=0.0},terms={time=0.0},debug={time=0.0}},process={time=0.0,query={time=0.0},facet={time=0.0},facet_module={time=0.0},mlt={time=0.0},highlight={time=0.0},stats={time=0.0},expand={time=0.0},terms={time=0.0},debug={time=0.0}}}}}"},
"http://ip:8983/solr/collection_shard1_replica1/|http://ip:8983/solr/collection_shard1_replica3/":{
"QTime":"0",
"ElapsedTime":"3",
"RequestPurpose":"GET_TOP_IDS",
"NumFound":"3884574",
"Response":"{responseHeader={zkConnected=true,status=0,QTime=0,params={df=contents,f.contents.hl.fragsize=50,distrib=false,hl=false,f.ttl.hl.snippets=1,f.kw_skl.hl.simple.post=</span>,fl=[id, score],shards.purpose=4,fsv=true,f.kw_skl.hl.snippets=1,f.ttl.hl.fragsize=0,shard.url=http://ip:8983/solr/collection_shard1_replica1/|http://ip:8983/solr/collection_shard1_replica3/,rid=-collection_shard2_replica1-1521525496479-3,f.kw_skl.hl.fragsize=0,hl.simple.pre= <span class=\"bg_yellow\">,f.kw_it.hl.alternateField=kw_it,f.kw_skl.hl.alternateField=kw_skl,defType=edismax,f.ttl.hl.simple.post=</span>,qf=contents currdesig lng ttl kw_skl kw_it,hl.highlightAlternate=false,f.contents.hl.snippets=3,hl.fl=ttl,kw_skl,kw_it,contents,wt=javabin,_=1521525657029,debug=[false, timing, track],qt=/resumesearch,f.contents.hl.simple.post=</span>,start=0,f.kw_it.hl.fragsize=0,f.kw_it.hl.simple.pre= <span class=\"bg_yellow\">,rows=10,version=2,hl.encoder=html,f.kw_it.hl.snippets=1,f.ttl.hl.alternateField=ttl,q=*:*,f.ttl.hl.simple.pre= <span class=\"bg_yellow\">,hl.simple.post=</span>,requestPurpose=GET_TOP_IDS,NOW=1521525496479,isShard=true,hl.method=postings,f.contents.hl.simple.pre= <span class=\"bg_yellow\">,f.kw_skl.hl.simple.pre= <span class=\"bg_yellow\">,f.kw_it.hl.simple.post=</span>,debugQuery=false}},response={numFound=3884574,start=0,maxScore=1.0,docs=[SolrDocument{id=30504181, score=1.0}, SolrDocument{id=30504213, score=1.0}, SolrDocument{id=30504221, score=1.0}, SolrDocument{id=30504252, score=1.0}, SolrDocument{id=30504264, score=1.0}, SolrDocument{id=30504291, score=1.0}, SolrDocument{id=30504319, score=1.0}, SolrDocument{id=30504346, score=1.0}, SolrDocument{id=30504350, score=1.0}, SolrDocument{id=30504355, score=1.0}]},sort_values={},debug={timing={time=0.0,prepare={time=0.0,query={time=0.0},facet={time=0.0},facet_module={time=0.0},mlt={time=0.0},highlight={time=0.0},stats={time=0.0},expand={time=0.0},terms={time=0.0},debug={time=0.0}},process={time=0.0,query={time=0.0},facet={time=0.0},facet_module={time=0.0},mlt={time=0.0},highlight={time=0.0},stats={time=0.0},expand={time=0.0},terms={time=0.0},debug={time=0.0}}}}}"},
"http://ip:8983/solr/collection_shard4_replica1/|http://ip:8983/solr/collection_shard4_replica3/":{
"QTime":"2",
"ElapsedTime":"6",
"RequestPurpose":"GET_TOP_IDS",
"NumFound":"3881377",
"Response":"{responseHeader={zkConnected=true,status=0,QTime=2,params={df=contents,f.contents.hl.fragsize=50,distrib=false,hl=false,f.ttl.hl.snippets=1,f.kw_skl.hl.simple.post=</span>,fl=[id, score],shards.purpose=4,fsv=true,f.kw_skl.hl.snippets=1,f.ttl.hl.fragsize=0,shard.url=http://ip:8983/solr/collection_shard4_replica1/|http://ip:8983/solr/collection_shard4_replica3/,rid=-collection_shard2_replica1-1521525496479-3,f.kw_skl.hl.fragsize=0,hl.simple.pre= <span class=\"bg_yellow\">,f.kw_it.hl.alternateField=kw_it,f.kw_skl.hl.alternateField=kw_skl,defType=edismax,f.ttl.hl.simple.post=</span>,qf=contents currdesig lng ttl kw_skl kw_it,hl.highlightAlternate=false,f.contents.hl.snippets=3,hl.fl=ttl,kw_skl,kw_it,contents,wt=javabin,_=1521525657029,debug=[false, timing, track],qt=/resumesearch,f.contents.hl.simple.post=</span>,start=0,f.kw_it.hl.fragsize=0,f.kw_it.hl.simple.pre= <span class=\"bg_yellow\">,rows=10,version=2,hl.encoder=html,f.kw_it.hl.snippets=1,f.ttl.hl.alternateField=ttl,q=*:*,f.ttl.hl.simple.pre= <span class=\"bg_yellow\">,hl.simple.post=</span>,requestPurpose=GET_TOP_IDS,NOW=1521525496479,isShard=true,hl.method=postings,f.contents.hl.simple.pre= <span class=\"bg_yellow\">,f.kw_skl.hl.simple.pre= <span class=\"bg_yellow\">,f.kw_it.hl.simple.post=</span>,debugQuery=false}},response={numFound=3881377,start=0,maxScore=1.0,docs=[SolrDocument{id=83997361, score=1.0}, SolrDocument{id=86755299, score=1.0}, SolrDocument{id=83997456, score=1.0}, SolrDocument{id=83997474, score=1.0}, SolrDocument{id=83997636, score=1.0}, SolrDocument{id=83997702, score=1.0}, SolrDocument{id=83997734, score=1.0}, SolrDocument{id=83997739, score=1.0}, SolrDocument{id=83997740, score=1.0}, SolrDocument{id=33944905, score=1.0}]},sort_values={},debug={timing={time=2.0,prepare={time=1.0,query={time=1.0},facet={time=0.0},facet_module={time=0.0},mlt={time=0.0},highlight={time=0.0},stats={time=0.0},expand={time=0.0},terms={time=0.0},debug={time=0.0}},process={time=0.0,query={time=0.0},facet={time=0.0},facet_module={time=0.0},mlt={time=0.0},highlight={time=0.0},stats={time=0.0},expand={time=0.0},terms={time=0.0},debug={time=0.0}}}}}"},
"http://ip:8983/solr/collection_shard5_replica2/|http://ip:8983/solr/collection_shard5_replica1/":{
"QTime":"1",
"ElapsedTime":"5",
"RequestPurpose":"GET_TOP_IDS",
"NumFound":"3885899",
"Response":"{responseHeader={zkConnected=true,status=0,QTime=1,params={df=contents,f.contents.hl.fragsize=50,distrib=false,hl=false,f.ttl.hl.snippets=1,f.kw_skl.hl.simple.post=</span>,fl=[id, score],shards.purpose=4,fsv=true,f.kw_skl.hl.snippets=1,f.ttl.hl.fragsize=0,shard.url=http://ip:8983/solr/collection_shard5_replica2/|http://ip:8983/solr/collection_shard5_replica1/,rid=-collection_shard2_replica1-1521525496479-3,f.kw_skl.hl.fragsize=0,hl.simple.pre= <span class=\"bg_yellow\">,f.kw_it.hl.alternateField=kw_it,f.kw_skl.hl.alternateField=kw_skl,defType=edismax,f.ttl.hl.simple.post=</span>,qf=contents currdesig lng ttl kw_skl kw_it,hl.highlightAlternate=false,f.contents.hl.snippets=3,hl.fl=ttl,kw_skl,kw_it,contents,wt=javabin,_=1521525657029,debug=[false, timing, track],qt=/resumesearch,f.contents.hl.simple.post=</span>,start=0,f.kw_it.hl.fragsize=0,f.kw_it.hl.simple.pre= <span class=\"bg_yellow\">,rows=10,version=2,hl.encoder=html,f.kw_it.hl.snippets=1,f.ttl.hl.alternateField=ttl,q=*:*,f.ttl.hl.simple.pre= <span class=\"bg_yellow\">,hl.simple.post=</span>,requestPurpose=GET_TOP_IDS,NOW=1521525496479,isShard=true,hl.method=postings,f.contents.hl.simple.pre= <span class=\"bg_yellow\">,f.kw_skl.hl.simple.pre= <span class=\"bg_yellow\">,f.kw_it.hl.simple.post=</span>,debugQuery=false}},response={numFound=3885899,start=0,maxScore=1.0,docs=[SolrDocument{id=38604136, score=1.0}, SolrDocument{id=38604159, score=1.0}, SolrDocument{id=38604197, score=1.0}, SolrDocument{id=38604210, score=1.0}, SolrDocument{id=38604216, score=1.0}, SolrDocument{id=38604237, score=1.0}, SolrDocument{id=38604252, score=1.0}, SolrDocument{id=38604258, score=1.0}, SolrDocument{id=38604260, score=1.0}, SolrDocument{id=38604290, score=1.0}]},sort_values={},debug={timing={time=1.0,prepare={time=0.0,query={time=0.0},facet={time=0.0},facet_module={time=0.0},mlt={time=0.0},highlight={time=0.0},stats={time=0.0},expand={time=0.0},terms={time=0.0},debug={time=0.0}},process={time=0.0,query={time=0.0},facet={time=0.0},facet_module={time=0.0},mlt={time=0.0},highlight={time=0.0},stats={time=0.0},expand={time=0.0},terms={time=0.0},debug={time=0.0}}}}}"}},
"GET_FIELDS":{
"http://ip:8983/solr/collection_shard2_replica2/|http://ip:8983/solr/collection_shard2_replica1/":{
"QTime":"27",
"ElapsedTime":"31",
"RequestPurpose":"GET_FIELDS,GET_HIGHLIGHTS,GET_DEBUG",
"NumFound":"10",
在“EXECUTE_QUERY”部分中可以看到,请求正在发送到所有副本。有人可以解释一下吗?
答案 0 :(得分:1)
查询的第一阶段是找出哪些碎片具有符合您条件的文档,以及哪些文档符合您的条件。由于无法通过集中式来确定哪些分片保存符合您条件的文档,因此查询将通过GET_TOP_IDS请求并行发送到所有分片。 GET_TOP_IDS被发送到给定分片的主或副本,而不是两者都发送。
从那里,将根据排序/行/分数将GET_DATA_FIELDS发送到一个或多个分片,以从由GET_TOP_IDS标识的一部分文档中获取请求的数据