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 Salman Ansari <sa...@gmail.com> on 2016/03/29 14:10:48 UTC
Distributing Collections across Shards
Hi,
I believe the default behavior of creating collections distributed across
shards through the following command
http://
[solrlocation]:8983/solr/admin/collections?action=CREATE&name=[collection_name]&numShards=2&replicationFactor=2&maxShardsPerNode=2&collection.configName=[configuration_name]
is that Solr will create the collection as follows
*shard1: *leader in server1 and replica in server2
*shard2:* leader in server2 and replica in server1
However, I have seen cases when running the above command that it creates
both the leader and replica on the same server.
Wondering if there is a way to control this behavior (I mean control where
the leader and the replica of each shard will reside)?
Regards,
Salman
Re: Distributing Collections across Shards
Posted by Salman Ansari <sa...@gmail.com>.
Thanks Erick for the help. Appreciate it.
Regards,
Salman
On Wed, Mar 30, 2016 at 7:29 AM, Erick Erickson <er...@gmail.com>
wrote:
> Absolutely. You haven't said which version of Solr you're using,
> but there are several possibilities:
> 1> create the collection with replicationFactor=1, then use the
> ADDREPLICA command to specify exactly what node the replicas
> for each shard are created on with the 'node' parameter.
> 2> For recent versions of Solr, you can create a collection with _no_
> replicas and then ADDREPLICA as you choose.
>
> Best,
> Erick
>
> On Tue, Mar 29, 2016 at 5:10 AM, Salman Ansari <sa...@gmail.com>
> wrote:
> > Hi,
> >
> > I believe the default behavior of creating collections distributed across
> > shards through the following command
> >
> > http://
> >
> [solrlocation]:8983/solr/admin/collections?action=CREATE&name=[collection_name]&numShards=2&replicationFactor=2&maxShardsPerNode=2&collection.configName=[configuration_name]
> >
> > is that Solr will create the collection as follows
> >
> > *shard1: *leader in server1 and replica in server2
> > *shard2:* leader in server2 and replica in server1
> >
> > However, I have seen cases when running the above command that it creates
> > both the leader and replica on the same server.
> >
> > Wondering if there is a way to control this behavior (I mean control
> where
> > the leader and the replica of each shard will reside)?
> >
> > Regards,
> > Salman
>
Re: Distributing Collections across Shards
Posted by Erick Erickson <er...@gmail.com>.
Absolutely. You haven't said which version of Solr you're using,
but there are several possibilities:
1> create the collection with replicationFactor=1, then use the
ADDREPLICA command to specify exactly what node the replicas
for each shard are created on with the 'node' parameter.
2> For recent versions of Solr, you can create a collection with _no_
replicas and then ADDREPLICA as you choose.
Best,
Erick
On Tue, Mar 29, 2016 at 5:10 AM, Salman Ansari <sa...@gmail.com> wrote:
> Hi,
>
> I believe the default behavior of creating collections distributed across
> shards through the following command
>
> http://
> [solrlocation]:8983/solr/admin/collections?action=CREATE&name=[collection_name]&numShards=2&replicationFactor=2&maxShardsPerNode=2&collection.configName=[configuration_name]
>
> is that Solr will create the collection as follows
>
> *shard1: *leader in server1 and replica in server2
> *shard2:* leader in server2 and replica in server1
>
> However, I have seen cases when running the above command that it creates
> both the leader and replica on the same server.
>
> Wondering if there is a way to control this behavior (I mean control where
> the leader and the replica of each shard will reside)?
>
> Regards,
> Salman