You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by Aurélien MAZOYER <au...@gmail.com> on 2022/12/01 11:07:59 UTC

Question regarding Replica placement

Hello,

I have some unexpected behavior regarding the replica placement. I am using
solr 9.1.0

I start two nodes :

solr.cmd start -c

solr.cmd start -p 8984 -z localhost:9983


I add my replica policy:

curl -X POST -H 'Content-type: application/json' -d '{

    "add":{

        "name": ".placement-plugin",

        "class":
"org.apache.solr.cluster.placement.plugins.AffinityPlacementFactory"

    }}'
  http://localhost:8983/api/cluster/plugin

I create a simple collection:
http://localhost:8983/solr/admin/collections?action=CREATE&name=products&replicationFactor=2&numShards=1&collection.configName=_default

My replica placement seems good:
[image: image.png]
But then I just start a 3rd node:
:solr.cmd start -p 8984 -z localhost:9983

And then my replica placement seems a bit strange:
[image: image.png]

How come all my replicas moved to the newly started node? Isn't the policy
supposed to make it best to avoid having more than one replica of the same
shard on the same node and to spread them?

Thanks for your insight!

Aurelien

Re: Question regarding Replica placement

Posted by Aurélien MAZOYER <au...@gmail.com>.
Hi community,

I'll answer myself in case somebody would share my concern.
When I do *not *run all the nodes on the same host (here I am using docker
instead), I eventually get the replica placement that I was expecting:
[image: image.png]

On my first try, I guess the AffinityPlacementFactory was behaving
differently because all my nodes were started on the same host (localhost).

Regards,

Aurelien

On Thu, 1 Dec 2022 at 12:07, Aurélien MAZOYER <au...@gmail.com>
wrote:

> Hello,
>
> I have some unexpected behavior regarding the replica placement. I am
> using solr 9.1.0
>
> I start two nodes :
>
> solr.cmd start -c
>
> solr.cmd start -p 8984 -z localhost:9983
>
>
> I add my replica policy:
>
> curl -X POST -H 'Content-type: application/json' -d '{
>
>     "add":{
>
>         "name": ".placement-plugin",
>
>         "class":
> "org.apache.solr.cluster.placement.plugins.AffinityPlacementFactory"
>
>     }}'
>   http://localhost:8983/api/cluster/plugin
>
> I create a simple collection:
>
> http://localhost:8983/solr/admin/collections?action=CREATE&name=products&replicationFactor=2&numShards=1&collection.configName=_default
>
> My replica placement seems good:
> [image: image.png]
> But then I just start a 3rd node:
> :solr.cmd start -p 8984 -z localhost:9983
>
> And then my replica placement seems a bit strange:
> [image: image.png]
>
> How come all my replicas moved to the newly started node? Isn't the policy
> supposed to make it best to avoid having more than one replica of the same
> shard on the same node and to spread them?
>
> Thanks for your insight!
>
> Aurelien
>
>