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 James Thomas <JT...@Camstar.com> on 2013/01/09 16:58:53 UTC
SolrCloud - shard distribution
Hi,
Simple question, I hope.
Using the nightly build of 4.1 from yesterday (Jan 8, 2013), I started 6 Solr nodes.
I issued the following command to create a collection with 3 shards, and a replication factor=2. So a total of 6 shards.
curl 'http://localhost:11000/solr/admin/collections?action=CREATE&name=consumer1&numShards=3&replicationFactor=2'
The end result was the following shard distribution:
shard1 - node #13, #15 (with #13 as leader)
shard2 - node #15, #16 (with #15 as leader)
shard3 - node #11, #16 (with #11 as leader)
Since I am using the default value of 1 for 'maxShardsPerNode', I was surprised to see that Solr created two shards on instance #16. I expected that each Solr node (there are 6) would each be assigned one shard from the collection. Is this a bug or expected behavior?
Thanks,
James
RE: SolrCloud - shard distribution
Posted by James Thomas <JT...@Camstar.com>.
Oops, small copy-paste error. Had my i's and j's backwards.
Should be:
--- slice1, rep2 (i=1,j=2) ==> chooses node[1]
--- slice2, rep1 (i=2,j=1) ==> chooses node[1]
-----Original Message-----
From: James Thomas [mailto:JThomas@Camstar.com]
Sent: Wednesday, January 09, 2013 1:39 PM
To: solr-user@lucene.apache.org
Subject: RE: SolrCloud - shard distribution
Thanks for the quick reply Mark.
I tried all kinds of variations, I could not get all 6 nodes to participate.
So I downloaded the source code and took a look at OverseerCollectionProcessor.java I think my result is as-coded.
Line 251 has this loop:
for (int i = 1; i <= numSlices; i++) {
for (int j = 1; j <= repFactor; j++) {
String nodeName = nodeList.get(((i - 1) + (j - 1)) % nodeList.size());
So for my inputs, numSlices=3 and repFactor=2.
And the logic here will choose the same node for these two slices:
--- slice1, rep2 (i=2,j=1) ==> chooses node[1]
--- slice2, rep1 (i=1,j=2) ==> chooses node[1]
BTW, I did notice the comment in the code:
// we need to look at every node and see how many cores it serves
// add our new cores to existing nodes serving the least number of cores
// but (for now) require that each core goes on a distinct node.
// TODO: add smarter options that look at the current number of cores per
// node?
// for now we just go random
Thanks,
James
-----Original Message-----
From: Mark Miller [mailto:markrmiller@gmail.com]
Sent: Wednesday, January 09, 2013 11:30 AM
To: solr-user@lucene.apache.org
Subject: Re: SolrCloud - shard distribution
I just tried this. I started 6 nodes with collection1 spread across two shards. Looked at the admin->cloud->graph view and everything looked right and green.
Next, I copy and pasted your command and refreshed the graph cloud view.
I see a new collection called consumer1 - all of it's nodes are green and the collection consists of 3 shards. Each shard has 1 leader and 1 replica, each hosted by a different Solr instance.
In other words, it seemed to work for me.
- Mark
On Jan 9, 2013, at 10:58 AM, James Thomas <JT...@Camstar.com> wrote:
> Hi,
>
> Simple question, I hope.
>
> Using the nightly build of 4.1 from yesterday (Jan 8, 2013), I started 6 Solr nodes.
> I issued the following command to create a collection with 3 shards, and a replication factor=2. So a total of 6 shards.
> curl 'http://localhost:11000/solr/admin/collections?action=CREATE&name=consumer1&numShards=3&replicationFactor=2'
> The end result was the following shard distribution:
> shard1 - node #13, #15 (with #13 as leader)
> shard2 - node #15, #16 (with #15 as leader)
> shard3 - node #11, #16 (with #11 as leader)
>
> Since I am using the default value of 1 for 'maxShardsPerNode', I was surprised to see that Solr created two shards on instance #16. I expected that each Solr node (there are 6) would each be assigned one shard from the collection. Is this a bug or expected behavior?
>
> Thanks,
> James
RE: SolrCloud - shard distribution
Posted by James Thomas <JT...@Camstar.com>.
Thanks for the quick reply Mark.
I tried all kinds of variations, I could not get all 6 nodes to participate.
So I downloaded the source code and took a look at OverseerCollectionProcessor.java
I think my result is as-coded.
Line 251 has this loop:
for (int i = 1; i <= numSlices; i++) {
for (int j = 1; j <= repFactor; j++) {
String nodeName = nodeList.get(((i - 1) + (j - 1)) % nodeList.size());
So for my inputs, numSlices=3 and repFactor=2.
And the logic here will choose the same node for these two slices:
--- slice1, rep2 (i=2,j=1) ==> chooses node[1]
--- slice2, rep1 (i=1,j=2) ==> chooses node[1]
BTW, I did notice the comment in the code:
// we need to look at every node and see how many cores it serves
// add our new cores to existing nodes serving the least number of cores
// but (for now) require that each core goes on a distinct node.
// TODO: add smarter options that look at the current number of cores per
// node?
// for now we just go random
Thanks,
James
-----Original Message-----
From: Mark Miller [mailto:markrmiller@gmail.com]
Sent: Wednesday, January 09, 2013 11:30 AM
To: solr-user@lucene.apache.org
Subject: Re: SolrCloud - shard distribution
I just tried this. I started 6 nodes with collection1 spread across two shards. Looked at the admin->cloud->graph view and everything looked right and green.
Next, I copy and pasted your command and refreshed the graph cloud view.
I see a new collection called consumer1 - all of it's nodes are green and the collection consists of 3 shards. Each shard has 1 leader and 1 replica, each hosted by a different Solr instance.
In other words, it seemed to work for me.
- Mark
On Jan 9, 2013, at 10:58 AM, James Thomas <JT...@Camstar.com> wrote:
> Hi,
>
> Simple question, I hope.
>
> Using the nightly build of 4.1 from yesterday (Jan 8, 2013), I started 6 Solr nodes.
> I issued the following command to create a collection with 3 shards, and a replication factor=2. So a total of 6 shards.
> curl 'http://localhost:11000/solr/admin/collections?action=CREATE&name=consumer1&numShards=3&replicationFactor=2'
> The end result was the following shard distribution:
> shard1 - node #13, #15 (with #13 as leader)
> shard2 - node #15, #16 (with #15 as leader)
> shard3 - node #11, #16 (with #11 as leader)
>
> Since I am using the default value of 1 for 'maxShardsPerNode', I was surprised to see that Solr created two shards on instance #16. I expected that each Solr node (there are 6) would each be assigned one shard from the collection. Is this a bug or expected behavior?
>
> Thanks,
> James
Re: SolrCloud - shard distribution
Posted by Mark Miller <ma...@gmail.com>.
I just tried this. I started 6 nodes with collection1 spread across two shards. Looked at the admin->cloud->graph view and everything looked right and green.
Next, I copy and pasted your command and refreshed the graph cloud view.
I see a new collection called consumer1 - all of it's nodes are green and the collection consists of 3 shards. Each shard has 1 leader and 1 replica, each hosted by a different Solr instance.
In other words, it seemed to work for me.
- Mark
On Jan 9, 2013, at 10:58 AM, James Thomas <JT...@Camstar.com> wrote:
> Hi,
>
> Simple question, I hope.
>
> Using the nightly build of 4.1 from yesterday (Jan 8, 2013), I started 6 Solr nodes.
> I issued the following command to create a collection with 3 shards, and a replication factor=2. So a total of 6 shards.
> curl 'http://localhost:11000/solr/admin/collections?action=CREATE&name=consumer1&numShards=3&replicationFactor=2'
> The end result was the following shard distribution:
> shard1 - node #13, #15 (with #13 as leader)
> shard2 - node #15, #16 (with #15 as leader)
> shard3 - node #11, #16 (with #11 as leader)
>
> Since I am using the default value of 1 for 'maxShardsPerNode', I was surprised to see that Solr created two shards on instance #16. I expected that each Solr node (there are 6) would each be assigned one shard from the collection. Is this a bug or expected behavior?
>
> Thanks,
> James