Hello,

Finally I've found the way to do it. Just limiting the replicas number by
node using policies is the trick:
curl -X POST -H 'Content-Type: application/json' '
http://localhost:8983/api/cluster/autoscaling' --data-binary '{
"set-cluster-policy": [{"replica": "<2", "shard": "#EACH", "node": "#ANY"}]
}'

Greetings!

El lun., 26 nov. 2018 a las 18:24, Daniel Carrasco (<d.carra...@i2tic.com>)
escribió:

> Hello,
>
> I'm trying to create an autoscaling cluster with node_added_trigger
> and node_lost_trigger triggers to allow to grow and srink depending of
> load, but I've not found too much info about this options and then only
> I've archieve is a collection that creates a lot of réplicas on same node
> when it starts, and another collection that just keeps with the same
> replica number.
>
> I've created three ZK nodes, and I've joined a Solr node to that ZK
> cluster.  After that, I've created two collections with this simple
> commands:
> curl "
> http://127.0.0.1:8983/solr/admin/collections?action=CREATE&name=test&numShards=1&replicationFactor=1&maxShardsPerNode=1
> "
> curl "
> http://127.0.0.1:8983/solr/admin/collections?action=CREATE&name=test2&numShards=1&replicationFactor=1&maxShardsPerNode=1
> "
>
> I've added the two triggers using the example of the Solr manual:
> curl -X POST -H 'Content-Type: application/json' '
> http://localhost:8983/solr/admin/autoscaling' --data-binary '{
> "set-trigger": {    "name": "node_added_trigger",    "event": "nodeAdded",
>   "waitFor": "5s",    "preferredOperation": "ADDREPLICA" } }'
> curl -X POST -H 'Content-Type: application/json' '
> http://localhost:8983/solr/admin/autoscaling' --data-binary '{
>  "set-trigger": {    "name": "node_lost_trigger",    "event": "nodeLost",
>   "waitFor": "120s",    "preferredOperation": "DELETENODE"  }}'
>
>
> And after all this, I've added a node to test.
> When that node starts, the test collection starts to add replicas without
> control (it added even 12 replicas on the new node), and the test2
> collection keeps on just one replica. If I delete the test collection and
> repeat the process of add the new node, then the test2 have the same
> behavior  and creates a lot of replicas on new node.
>
> Delete trigger works just fine, and when the node is down for about 120s
> it is deleted from collection without problem.
>
> Is there any way to create just one replica when a node joins the cluster?.
>
> Thanks!
> --
> _________________________________________
>
>       Daniel Carrasco Marín
>       Ingeniería para la Innovación i2TIC, S.L.
>       Tlf:  +34 911 12 32 84 Ext: 223
>       www.i2tic.com
> _________________________________________
>


-- 
_________________________________________

      Daniel Carrasco Marín
      Ingeniería para la Innovación i2TIC, S.L.
      Tlf:  +34 911 12 32 84 Ext: 223
      www.i2tic.com
_________________________________________

Reply via email to