You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Alexandre Drouin <al...@orckestra.com> on 2016/08/11 17:16:02 UTC
Create collection on all nodes using the Collection API
Hi,
What would be the best/easiest way to create a collection (only one shard) using the Collection API and have a replica created on all live nodes?
Using the 'create collection' API, I can use the 'replicationFactor' parameter and specify the number of replica I want for my collection. So if I have 3 lives nodes I can say 'replicationFactor=3' and my collection will have a replica on all lives nodes. However I do not want to 'hardcode' my number of live nodes for obvious reasons, so because of that I have the following questions:
1) Is there a way to create a collection (only one shard) and having a replica of the shard on all live nodes?
2) Assuming #1 is not possible, is it possible to have the list of live nodes ? If I can have the list of live nodes I could detect the number required for the replicationFactor parameter.
Thanks
Alexandre Drouin
Re: Create collection on all nodes using the Collection API
Posted by Anshum Gupta <an...@anshumgupta.net>.
Hi Alexandre,
You can you the CLUSTERSTATUS Collections API (
https://cwiki.apache.org/confluence/display/solr/Collections+API#CollectionsAPI-api18)
to get a list of live nodes.
-Anshum
On Thu, Aug 11, 2016 at 10:16 AM Alexandre Drouin <
alexandre.drouin@orckestra.com> wrote:
> Hi,
>
> What would be the best/easiest way to create a collection (only one shard)
> using the Collection API and have a replica created on all live nodes?
>
> Using the 'create collection' API, I can use the 'replicationFactor'
> parameter and specify the number of replica I want for my collection. So
> if I have 3 lives nodes I can say 'replicationFactor=3' and my collection
> will have a replica on all lives nodes. However I do not want to
> 'hardcode' my number of live nodes for obvious reasons, so because of that
> I have the following questions:
>
> 1) Is there a way to create a collection (only one shard) and having a
> replica of the shard on all live nodes?
>
> 2) Assuming #1 is not possible, is it possible to have the list of live
> nodes ? If I can have the list of live nodes I could detect the number
> required for the replicationFactor parameter.
>
> Thanks
>
> Alexandre Drouin
>