solr - SolrCloud Indexing/Querying without a Smart-Client -
i'm having bit of trouble understanding how indexing , querying work if don't have smart-client available. i'm using solrnet c#, doesn't integrate zookeeper.
as basic example, let's have single collection, split 2 shards, replicated across 2 separate nodes/servers, , have standard http load-balancer in front of servers (a scenario mentioned here). if use standard compositeid router, believe indexing work without issue , replicated both nodes zookeeper behind scenes. wouldn't need worry node received "update" command -- zookeeper handle document routing , replication automatically.
however, in same scenario, zookeeper handle query routing behind scenes correctly? given i'm using built-in sharding , not custom sharding, query request load-balancer routed correct shard, or have include all known shards in "shards" parameter (see here) make sure don't miss anything? onerous maintain number of shards grows.
is seems custom sharding provide greatest efficiency across indexing , querying, although run risk wildly unequal shard sizes. thoughts on these matters appreciated.
lets take example of 2 shard collection, each shard on separate node/server.
10.x.x.100:8983/solr/ --> shard 1 / node 1
10.x.x.101:8983/solr/ --> shard 2 / node 2
using default routing indexed 100 documents got split these 2 servers , have 50 documents each.
if query of 2 servers documents, solr search in both shards default. not need specify in shards parameter.
so
10.x.x.100:8983/solr/collection/select?q=solr rocks
will run same query on 10.x.x.101:8983/solr/
, results returned combination of results both shards, sorted , ranked score.
the &shards
parameter comes picture when know "group" of data in shard. example using above example, have custom routing enabled , use field "city" route documents. sake of example, lets assume there can 2 values "city" field. documents routed 1 of shards based on field.
on application side, if want query documents belonging city, can specify &shard
parameter, , results query shard.
Comments
Post a Comment