On 1/10/2018 12:18 AM, manish tanger wrote:
I am having a doubt in implicit routing and didn't find much info about
this over the internet, so Please help me out on this.

*About environment:*
M/c 1: Zookeeper 1 and Solr 1
M/c 2: Zookeeper 2 and Solr 2

For redundancy with ZK, you need three hosts minimum.  A two-host ZK ensemble is actually *less* reliable than using one server.  You aren't protected against failure until you have at least three.  You would only need a minimum of two Solr hosts, though.

I am using clustered zookeeper and using "CloudSolrClient" from solrJ
API in java.

*this.solrCloudClient = new
CloudSolrClient.Builder().withZkHost(zkHostList).build();*

*Requirement:*

My requirement is to store lots of data on solr using a single collection.
so my idea is that i am going to create a new shard for every hour so that
indexing doesn't take much time.

I choose for the implicit document routing, but I am unable to redirect the
docs on the particular shard. Zookeeper is still distributing it on all
nodes and shards.

ZooKeeper isn't responsible for distributing documents between shards.  It is Solr that does this, using information in the ZK database.  With the implicit router, the only routing information in ZK is the shard names.  Solr cannot make decisions about which shard gets the documents, that information must come from the system doing the indexing.

*What I have tried:*
1. I have created a collection with implicit routing and put customer
routing field "*dateandhour*" and add it as a filed in my collection.

     While adding solr input doc I am setting this filed with shard name.

What was the precise commands or API calls that you used to create the collection?  What is the definition of the dateandhour field?

2. I have also tried to add shard name to id filed like:
      id="*shardName!*uniquedocumentId"

If you want to use a prefix in the uniqueId field, you must be using the compositeId router, not the implicit router.  The compositeId router will not fit your use case, though -- you cannot add shards to a collection if it uses compositeId.  Also, the prefix does not specify the shard by name, the value of the prefix is hashed to determine which shard(s) are used.

Here's the documentation on document routing:

https://lucene.apache.org/solr/guide/7_2/shards-and-indexing-data-in-solrcloud.html#ShardsandIndexingDatainSolrCloud-DocumentRouting

Thanks,
Shawn

Reply via email to