Adding router.field property to an existing collection.

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Adding router.field property to an existing collection.

Modassar Ather-2
Hi,

I have a setup of two shard with embedded zookeeper and one collection on
two tomcat instances. I cannot use uniqueKey i.e the compositeId routing
for document routing as per my understanding it will change the uniqueKey.
There is another way mentioned on Solr wiki is by using "router.field". I
could not find a way of setting it in solr.xml/other configuration file to
get it added.

Kindly share your suggestion on:
 How I can use router.field in an existing collection?
 Create a collection with router.field and implicit routing enabled?

Thanks,
Modassar
Reply | Threaded
Open this post in threaded view
|

Re: Adding router.field property to an existing collection.

Damien Dykman

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Modassar,

I ran into the same issue (Solr 4.8.1) with an existing collection set
to "implicit" routing but with no "router.field" defined. I managed to
set the "router.field" by modifying /clusterstate.json and pushing it
back to Zookeeper. For instance, I use field "shard_name" for routing.
Now, in my /clusterstate.json, I have:

"router":{
      "name":"implicit",
      "field":"shard_name"
}

Warning: you'll probably need to reload your collection (see Collection
API) for the change to be taken into account. Or a more brutal way,
restart your Solr nodes. Then you should see the update in
http://localhost:8983/solr/admin/collections?action=clusterstatus.

I'd be curious to know if there's a cleaner method though, rather than
modifying /clusterstate.json.

Otherwise, if you want to create a collection from scratch with implict
routing and a router.field (see Collection API), use:

http://localhost:8983/solr/admin/collections?action=CREATE&name=my_collection&router.name=implicit&router.field=shard_name

Good luck,
Damien

On 05/06/2014 05:59 AM, Modassar Ather wrote:

> Hi,
>
> I have a setup of two shard with embedded zookeeper and one collection on
> two tomcat instances. I cannot use uniqueKey i.e the compositeId routing
> for document routing as per my understanding it will change the uniqueKey.
> There is another way mentioned on Solr wiki is by using "router.field". I
> could not find a way of setting it in solr.xml/other configuration file to
> get it added.
>
> Kindly share your suggestion on:
>  How I can use router.field in an existing collection?
>  Create a collection with router.field and implicit routing enabled?
>
> Thanks,
> Modassar
>

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTqyixAAoJENfoFMxpEaCCPGgH/iAyTPeWbEtdgWdLN46kP3RT
vnSzf2qFEE4bXgdyVVuuZ/dagEPYUDxn9EhSwOrzuZmJcBNpgaTP8lZtejRo6LCO
jYItfO14uq/wEczelyvb3iEAqFYdCG1hQxpmabEi1uuLvLCgwLgbgsvZ8AR7l3ci
IGdQvMnD004VRXIAqErpv8E24ChH+qD+gC7ed4FiAhKfb6fBvNmsoIqmPSRcmeZX
zXjSZJ3K/c3P+pddKaEGr6BFccb/zIK/yJ/q/ihZIr1kyBnjEBfhhlBhgSvVXBEu
l97gvyz84WO5++TGFNbNIAj9quTu6+23Rn2ohjcMpz9TA9RtVbNImoZ5wQ0qjYY=
=F0U4
-----END PGP SIGNATURE-----

Reply | Threaded
Open this post in threaded view
|

Re: Adding router.field property to an existing collection.

Modassar Ather-2
Thanks Damien for your response.
We have modified our Solr schema a little bit to add router.field.

Regards,
Modassar



On Thu, Jun 26, 2014 at 1:23 AM, Damien Dykman <[hidden email]>
wrote:

>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi Modassar,
>
> I ran into the same issue (Solr 4.8.1) with an existing collection set
> to "implicit" routing but with no "router.field" defined. I managed to
> set the "router.field" by modifying /clusterstate.json and pushing it
> back to Zookeeper. For instance, I use field "shard_name" for routing.
> Now, in my /clusterstate.json, I have:
>
> "router":{
>       "name":"implicit",
>       "field":"shard_name"
> }
>
> Warning: you'll probably need to reload your collection (see Collection
> API) for the change to be taken into account. Or a more brutal way,
> restart your Solr nodes. Then you should see the update in
> http://localhost:8983/solr/admin/collections?action=clusterstatus.
>
> I'd be curious to know if there's a cleaner method though, rather than
> modifying /clusterstate.json.
>
> Otherwise, if you want to create a collection from scratch with implict
> routing and a router.field (see Collection API), use:
>
>
> http://localhost:8983/solr/admin/collections?action=CREATE&name=my_collection&router.name=implicit&router.field=shard_name
>
> Good luck,
> Damien
>
> On 05/06/2014 05:59 AM, Modassar Ather wrote:
> > Hi,
> >
> > I have a setup of two shard with embedded zookeeper and one collection on
> > two tomcat instances. I cannot use uniqueKey i.e the compositeId routing
> > for document routing as per my understanding it will change the
> uniqueKey.
> > There is another way mentioned on Solr wiki is by using "router.field". I
> > could not find a way of setting it in solr.xml/other configuration file
> to
> > get it added.
> >
> > Kindly share your suggestion on:
> >  How I can use router.field in an existing collection?
> >  Create a collection with router.field and implicit routing enabled?
> >
> > Thanks,
> > Modassar
> >
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.12 (GNU/Linux)
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iQEcBAEBAgAGBQJTqyixAAoJENfoFMxpEaCCPGgH/iAyTPeWbEtdgWdLN46kP3RT
> vnSzf2qFEE4bXgdyVVuuZ/dagEPYUDxn9EhSwOrzuZmJcBNpgaTP8lZtejRo6LCO
> jYItfO14uq/wEczelyvb3iEAqFYdCG1hQxpmabEi1uuLvLCgwLgbgsvZ8AR7l3ci
> IGdQvMnD004VRXIAqErpv8E24ChH+qD+gC7ed4FiAhKfb6fBvNmsoIqmPSRcmeZX
> zXjSZJ3K/c3P+pddKaEGr6BFccb/zIK/yJ/q/ihZIr1kyBnjEBfhhlBhgSvVXBEu
> l97gvyz84WO5++TGFNbNIAj9quTu6+23Rn2ohjcMpz9TA9RtVbNImoZ5wQ0qjYY=
> =F0U4
> -----END PGP SIGNATURE-----
>
>