sharding - How to Insert a document to a specific shard in Apache Solr Cloud Mode -
is there way can add documents specific shard?
for example, documents type inserted shard1 , document type b go shard2.
i have tried using custom router not guaranty different prefix route different shard.
ps. on solr 5 using cloud mode.
a caveat: i'm using solrnet access solrcloud, , doesn't integrate zookeeper yet. java clients, might far easier.
despite read here , here regard compositeid router
, never work. @jay helped me figure out way use "implicit" routing achieve this. if create collection (leave out numshards
parameter):
http://localhost:8983/solr/admin/collections?action=create&name=mycol&maxshardspernode=2&router.name=implicit&shards=shard1,shard2&router.field=shard
then add field schema.xml
named "shard" (matching router.field
parameter), can index specific shard adding shard
field document being indexed , specifying shard name. @ query time, can specify shards
search -- more here (i able specify shard name w/o specific address).
i haven't tested in production yet, have verified using multiple virtualbox instances, zookeeper, haproxy, , several solr nodes, , it's doing expected. corrections , comments welcome.
Comments
Post a Comment