[ 
https://issues.apache.org/jira/browse/SOLR-13383?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16813518#comment-16813518
 ] 

Richard commented on SOLR-13383:
--------------------------------

Hi [~antojohn]
Sorry I'm having a bit of difficulty understanding, but I *think* I know what 
you're after.

Theory:
You want to have as many replicas as there are nodes? For example, you 
originally started with 3 nodes, and your shard had 3 replicas, but, when you 
added 2 more nodes, you still had 3 replicas, and not 5, but you want 5?

Solution:
I think the replication factor you're setting when creating the collection 
could be the issue.

{panel:title=SolrCloud Autoscaling Automatically Adding Replicas}
Solr provides a way to automatically add replicas for a collection when the 
number of active replicas drops below the replication factor specified at the 
time of the creation of the collection.
{panel}
This goes back to you adding the {{&autoAddReplicas=true}} to your collection 
creation, which should work if you re-enable that _(sorry for the confusion, I 
have better understanding of your problem now)_.

But if your replication factor is set to 3, and you have 3 healthy replicas, 
and you add 2 more nodes into your cluster. Solr will see this as no actions 
needed.

It also looks like that you can not add {{    "preferredOperation": 
"ADDREPLICA"}} to your triggers. I've had a look at the source code:

[v7.4 
NodeAddedTrigger|https://github.com/apache/lucene-solr/blob/branch_7_4/solr/core/src/java/org/apache/solr/cloud/autoscaling/NodeAddedTrigger.java]
[v7.5 
NodeAddedTrigger|https://github.com/apache/lucene-solr/blob/branch_7_5/solr/core/src/java/org/apache/solr/cloud/autoscaling/NodeAddedTrigger.java]

The main difference to pay attention to is the following _(around line 39)_
{code}
- v7.4 , + v7.5
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

+ import static org.apache.solr.common.params.AutoScalingParams.PREFERRED_OP;
{code}
So in v7.5 they introduce this variable {{PREFERRED_OP}} which allows you to 
implement {{ADDREPLICA}} which you tried to do previously. 

Because of this I don't think it's necessarily a bug of v7.4 more just a 
feature that is present in v7.5+

> auto-scaling not working in solr7.4 - autoaddreplica
> ----------------------------------------------------
>
>                 Key: SOLR-13383
>                 URL: https://issues.apache.org/jira/browse/SOLR-13383
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: config-api
>    Affects Versions: 7.4
>         Environment: Production
>            Reporter: AntonyJohnson
>            Priority: Blocker
>              Labels: performance
>             Fix For: 7.4.1
>
>         Attachments: 3collections.PNG
>
>
> We're able to create new server via auto-scaling for our solr cluster 7.4 
> version. But the newly created server is not adding in our solr cluster 
> automatically. Is there any settings or configurations we need to add in 
> order to add the replica automatically in cluster for any collections.
> *commands used:* 
> {code:java}
> curl 
> "http://localhost:8983/solr/admin/collections?action=CREATE&name=my_collection_3&numShards=1&replicationFactor=3&autoAddReplicas=true";
> {code}
> Currently 3 nodes are in our cluster and i'm trying to add 4th nod but its 
> not getting added in solr 7.4 version. The same scenario is working fine in 
> solr 7.5 version.
> *scaling policy used:*
> {code:java}
> 1)
> curl http://localhost:8983/solr/admin/autoscaling -H 
> 'Content-type:application/json' -d '{
>  "set-cluster-policy" : [{
>  "replica" : "1",
>  "shard" : "#EACH",
>  "node" : "#ANY",
>  }]
> }'
> 2)###Node Added Trigger
> curl http://localhost:8983/solr/admin/autoscaling -H 
> 'Content-type:application/json' -d '{
> "set-trigger": {
> "name" : "node_added_trigger",
> "event" : "nodeAdded",
> "waitFor" : "5s",
> "preferredOperation": "ADDREPLICA",
> "enabled" : true,
> "actions" : [
> {
> "name" : "compute_plan",
> "class": "solr.ComputePlanAction"
> },
> {
> "name" : "execute_plan",
> "class": "solr.ExecutePlanAction"
> }
> ]
> }
> }'
> 3)###Node Lost Trigger
> curl http://localhost:8983/solr/admin/autoscaling -H 
> 'Content-type:application/json' -d '{
> "set-trigger": {
> "name" : "node_lost_trigger",
> "event" : "nodeLost",
> "waitFor" : "5s",
> "preferredOperation": "DELETENODE",
> "enabled" : true,
> "actions" : [
> {
> "name" : "compute_plan",
> "class": "solr.ComputePlanAction"
> },
> {
> "name" : "execute_plan",
> "class": "solr.ExecutePlanAction"
> }
> ]
> }
> }'
> {code}
> Note the same policy(2,3) not working in 7.4
> *Errors:*
> {code:java}
> [Mon Apr 08 11:52:00 UTC root@hawkeye-common ~]# curl 
> http://localhost:8983/solr/admin/autoscaling -H 
> 'Content-type:application/json' -d '{
> >  "set-trigger": {
> >   "name" : "node_added_trigger",
> >   "event" : "nodeAdded",
> >   "waitFor" : "5s",
> >   "preferredOperation": "ADDREPLICA",
> >   "enabled" : true,
> >   "actions" : [
> >    {
> >     "name" : "compute_plan",
> >     "class": "solr.ComputePlanAction"
> >    },
> >    {
> >     "name" : "execute_plan",
> >     "class": "solr.ExecutePlanAction"
> >    }
> >   ]
> >  }
> > }'
> {
>   "responseHeader":{
>     "status":400,
>     "QTime":5},
>   "result":"failure",
>   "WARNING":"This response format is experimental.  It is likely to change in 
> the future.",
>   "error":{
>     "metadata":[
>       "error-class","org.apache.solr.api.ApiBag$ExceptionWithErrObject",
>       "root-error-class","org.apache.solr.api.ApiBag$ExceptionWithErrObject"],
>     "details":[{
>         "set-trigger":{
>           "name":"node_added_trigger",
>           "event":"nodeAdded",
>           "waitFor":"5s",
>           "preferredOperation":"ADDREPLICA",
>           "enabled":true,
>           "actions":[{
>               "name":"compute_plan",
>               "class":"solr.ComputePlanAction"},
>             {
>               "name":"execute_plan",
>               "class":"solr.ExecutePlanAction"}]},
>         "errorMessages":["Error validating trigger config node_added_trigger: 
> TriggerValidationException{name=node_added_trigger, 
> details='{preferredOperation=unknown property}'}"]}],
>     "msg":"Error in command payload",
>     "code":400}}
> [Mon Apr 08 11:52:09 UTC root@hawkeye-common ~]#
> [Mon Apr 08 11:52:16 UTC root@hawkeye-common ~]# curl 
> http://localhost:8983/solr/admin/autoscaling -H 
> 'Content-type:application/json' -d '{
> >  "set-trigger": {
> >   "name" : "node_lost_trigger",
> >   "event" : "nodeLost",
> >   "waitFor" : "5s",
> >   "preferredOperation": "DELETENODE",
> >   "enabled" : true,
> >   "actions" : [
> >    {
> >     "name" : "compute_plan",
> >     "class": "solr.ComputePlanAction"
> >    },
> >    {
> >     "name" : "execute_plan",
> >     "class": "solr.ExecutePlanAction"
> >    }
> >   ]
> >  }
> > }'
> {
>   "responseHeader":{
>     "status":400,
>     "QTime":1},
>   "result":"failure",
>   "WARNING":"This response format is experimental.  It is likely to change in 
> the future.",
>   "error":{
>     "metadata":[
>       "error-class","org.apache.solr.api.ApiBag$ExceptionWithErrObject",
>       "root-error-class","org.apache.solr.api.ApiBag$ExceptionWithErrObject"],
>     "details":[{
>         "set-trigger":{
>           "name":"node_lost_trigger",
>           "event":"nodeLost",
>           "waitFor":"5s",
>           "preferredOperation":"DELETENODE",
>           "enabled":true,
>           "actions":[{
>               "name":"compute_plan",
>               "class":"solr.ComputePlanAction"},
>             {
>               "name":"execute_plan",
>               "class":"solr.ExecutePlanAction"}]},
>         "errorMessages":["Error validating trigger config node_lost_trigger: 
> TriggerValidationException{name=node_lost_trigger, 
> details='{preferredOperation=unknown property}'}"]}],
>     "msg":"Error in command payload",
>     "code":400}}
> {code}
> We're able to create new server via auto-scaling for our solr cluster 7.4 
> version. But the newly created server is not adding in our solr cluster 
> automatically. Is there any settings or configurations we need to add in 
> order to add the replica automatically in cluster for any collections.
> commands used: curl 
> "http://localhost:8983/solr/admin/collections?action=CREATE&name=my_collection_3&numShards=1&replicationFactor=3&autoAddReplicas=true";
> Currently 3 nodes are in our cluster and i'm trying to add 4th nod but its 
> not getting added in solr 7.4 version. The same scenario is working fine in 
> solr 7.5 version.
> scaling policy used:
> 1)
> curl http://localhost:8983/solr/admin/autoscaling -H 
> 'Content-type:application/json' -d '{
>  "set-cluster-policy" : [{
>   "replica" : "1",
>   "shard" : "#EACH",
>   "node" : "#ANY",
>  }]
> }'
> 2)###Node Added Trigger
> curl http://localhost:8983/solr/admin/autoscaling -H 
> 'Content-type:application/json' -d '{
>  "set-trigger": {
>   "name" : "node_added_trigger",
>   "event" : "nodeAdded",
>   "waitFor" : "5s",
>   "preferredOperation": "ADDREPLICA",
>   "enabled" : true,
>   "actions" : [
>    {
>     "name" : "compute_plan",
>     "class": "solr.ComputePlanAction"
>    },
>    {
>     "name" : "execute_plan",
>     "class": "solr.ExecutePlanAction"
>    }
>   ]
>  }
> }'
> 3)###Node Lost Trigger
> curl http://localhost:8983/solr/admin/autoscaling -H 
> 'Content-type:application/json' -d '{
>  "set-trigger": {
>   "name" : "node_lost_trigger",
>   "event" : "nodeLost",
>   "waitFor" : "5s",
>   "preferredOperation": "DELETENODE",
>   "enabled" : true,
>   "actions" : [
>    {
>     "name" : "compute_plan",
>     "class": "solr.ComputePlanAction"
>    },
>    {
>     "name" : "execute_plan",
>     "class": "solr.ExecutePlanAction"
>    }
>   ]
>  }
> }'
> Note the same policy(2,3) not working in 7.4
> Errors:
> {code:java}
> [Mon Apr 08 11:52:00 UTC root@hawkeye-common ~]# curl 
> http://localhost:8983/solr/admin/autoscaling -H 
> 'Content-type:application/json' -d '{
> >  "set-trigger": {
> >   "name" : "node_added_trigger",
> >   "event" : "nodeAdded",
> >   "waitFor" : "5s",
> >   "preferredOperation": "ADDREPLICA",
> >   "enabled" : true,
> >   "actions" : [
> >    {
> >     "name" : "compute_plan",
> >     "class": "solr.ComputePlanAction"
> >    },
> >    {
> >     "name" : "execute_plan",
> >     "class": "solr.ExecutePlanAction"
> >    }
> >   ]
> >  }
> > }'
> {
>   "responseHeader":{
>     "status":400,
>     "QTime":5},
>   "result":"failure",
>   "WARNING":"This response format is experimental.  It is likely to change in 
> the future.",
>   "error":{
>     "metadata":[
>       "error-class","org.apache.solr.api.ApiBag$ExceptionWithErrObject",
>       "root-error-class","org.apache.solr.api.ApiBag$ExceptionWithErrObject"],
>     "details":[{
>         "set-trigger":{
>           "name":"node_added_trigger",
>           "event":"nodeAdded",
>           "waitFor":"5s",
>           "preferredOperation":"ADDREPLICA",
>           "enabled":true,
>           "actions":[{
>               "name":"compute_plan",
>               "class":"solr.ComputePlanAction"},
>             {
>               "name":"execute_plan",
>               "class":"solr.ExecutePlanAction"}]},
>         "errorMessages":["Error validating trigger config node_added_trigger: 
> TriggerValidationException{name=node_added_trigger, 
> details='{preferredOperation=unknown property}'}"]}],
>     "msg":"Error in command payload",
>     "code":400}}
> [Mon Apr 08 11:52:09 UTC root@hawkeye-common ~]#
> [Mon Apr 08 11:52:16 UTC root@hawkeye-common ~]# curl 
> http://localhost:8983/solr/admin/autoscaling -H 
> 'Content-type:application/json' -d '{
> >  "set-trigger": {
> >   "name" : "node_lost_trigger",
> >   "event" : "nodeLost",
> >   "waitFor" : "5s",
> >   "preferredOperation": "DELETENODE",
> >   "enabled" : true,
> >   "actions" : [
> >    {
> >     "name" : "compute_plan",
> >     "class": "solr.ComputePlanAction"
> >    },
> >    {
> >     "name" : "execute_plan",
> >     "class": "solr.ExecutePlanAction"
> >    }
> >   ]
> >  }
> > }'
> {
>   "responseHeader":{
>     "status":400,
>     "QTime":1},
>   "result":"failure",
>   "WARNING":"This response format is experimental.  It is likely to change in 
> the future.",
>   "error":{
>     "metadata":[
>       "error-class","org.apache.solr.api.ApiBag$ExceptionWithErrObject",
>       "root-error-class","org.apache.solr.api.ApiBag$ExceptionWithErrObject"],
>     "details":[{
>         "set-trigger":{
>           "name":"node_lost_trigger",
>           "event":"nodeLost",
>           "waitFor":"5s",
>           "preferredOperation":"DELETENODE",
>           "enabled":true,
>           "actions":[{
>               "name":"compute_plan",
>               "class":"solr.ComputePlanAction"},
>             {
>               "name":"execute_plan",
>               "class":"solr.ExecutePlanAction"}]},
>         "errorMessages":["Error validating trigger config node_lost_trigger: 
> TriggerValidationException{name=node_lost_trigger, 
> details='{preferredOperation=unknown property}'}"]}],
>     "msg":"Error in command payload",
>     "code":400}}
> {code}
> if any new sever added into that cluster the data(collection) must be added 
> as a replica in that cluster.[AddReplica Automatically added in version 7.5]
> https://i.stack.imgur.com/DgEbL.png
> Kindly help me to resolve this case.
> I need a exact trigger which will perform a AutoAddReplica Action



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to