Hi Shai,

As of now, all replicas for a collections are created to meet the specified
replication factor at the time of collection creation. There's no way to
defer that until more nodes are up. Your best bet is to have the nodes
already up before you CREATE the collection or create the collection with a
lower replication factor and then use ADDREPLICA.

About auto-addition of replicas, that's kind of supported when using shared
file system (HDFS) to host the index. It's doesn't truly work as per your
use-case i.e. it doesn't consider the intended replication factor but only
brings up a Replica in case all replicas for a node are down, so that
SolrCloud continues to be usable. It also doesn't auto-remove replica when
the old node comes back up. You can read more about this in the
"Automatically Add Replicas in SolrCloud" section here:
https://cwiki.apache.org/confluence/display/solr/Running+Solr+on+HDFS

About #3, i line with my answer to the previous question, Solr wouldn't
auto-add a Replica to meet the replication factor when a node goes down.


On Tue, Mar 24, 2015 at 12:36 AM, Shai Erera <ser...@gmail.com> wrote:

> Hi
>
> I saw that we can define maxShardsPerNode when creating a collection, but I
> don't see that I can set something similar for replicas. My scenario is the
> following:
>
>    - I setup one Solr node
>    - Create collection with numShards=1 and replicationFactor=2
>    - Hopefully, one replica is created on that node
>    - When I bring up the second Solr node, the second replica will be
>    created
>
> What I see is that both replicas are created on the first node, and when I
> bring up the second Solr node, none of the replicas are moved.
>
> I know that I can "move" one replica by calling ADDREPLICA on node2, then
> DELETEREPLICA on node1, but I was wondering if there's an automated way to
> do that.
>
> I've also considered creating the collection with replicationFactor=1 and
> when the second node comes up it will look for shards w/ one replica only,
> and assign themselves as the replica. But it means I have to own that piece
> of logic, where if Solr already does that, that's better.
>
> Also, from what I understand, if I create a collection w/ rf=2 and there
> are two nodes, then each node is assigned a replica. If one of the nodes
> comes down, and a 3rd node comes up, it will be assigned a replica -- is
> that correct?
>
> Another related question, if there are two replicas on node1 and node2, and
> node2 goes down -- will node1 be assigned the second replica as well?
>
> If this is explained somewhere, I'd appreciate if you can give me a
> pointer.
>
> Shai
>



-- 
Anshum Gupta

Reply via email to