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 Yuan Zhao <yu...@pivotal.io> on 2020/02/04 08:44:25 UTC

How can shards distributed evenly among nodes

Hi Team,

We are using autoscaling policy, we make use of the utilize node feature to
move replica to new nod.
But we found after replica are moved, solr can make sure the repilica
belongs to a same shard located
on different nodes,  but it can not make sure shard distributed evenly on
all the nodes.
That means a node might contain all the shards of an index.
And, more remarkable, the shards distributed evenly before utilize node
command is executed.

   index_name  | replica_name | shard_name |          node_name           |
replica_state
---------------+--------------+------------+------------------------------+---------------
 test_index.t2 | core_node6   | shard1     | test-server:8983_solr        |
active
 test_index.t4 | core_node7   | shard2     | test-server:8983_solr        |
active
 test_index.t4 | core_node5   | shard1     | test-server:8983_solr        |
active
 test_index.t2 | core_node4   | shard0     | test-server:8983_solr        |
active
 test_index.t1 | core_node3   | shard1     | test-server:8984_solr        |
active
 test_index.t4 | core_node8   | shard2     | test-server:8984_solr        |
active
 test_index.t3 | core_node8   | shard1     | test-server:8984_solr        |
active
 test_index.t2 | core_node2   | shard0     | test-server:8984_solr        |
active
 test_index.t2 | core_node10  | shard1     | test-server:8985_solr        |
active
 test_index.t1 | core_node18  | shard2     | test-server:8985_solr        |
active
 test_index.t4 | core_node10  | shard1     | test-server:8985_solr        |
active
 test_index.t3 | core_node10  | shard0     | test-server:8985_solr        |
active
 test_index.t1 | core_node14  | shard2     | test-server:8987_solr        |
active
 test_index.t3 | core_node14  | shard0     | test-server:8987_solr        |
active
 test_index.t3 | core_node12  | shard1     | test-server:8987_solr        |
active
 test_index.t1 | core_node16  | shard1     | test-server:8987_solr        |
active

 Do you have any good solution to this problem.
 The solr version we are using is 7.4.
 The cluster policy like:
 {
"set-cluster-policy" : [{
 "replica" : "<2",
 "shard" : "#EACH",
 "node" : "#ANY",
 "strict" : false
}]
}

-- 
Thanks & regards,
Yuan

Re: How can shards distributed evenly among nodes

Posted by Radar Lei <rl...@pivotal.io>.
This is weird, when we creating an index, Solr will make sure shards of an
index be distributed to all the existing nodes evenly. But after you used
'UTILIZENODE' of AutoScale, Solr will try to put all the shards of an index
to one or several nodes. Is this intentional or a bug?

For example, we have a four nodes Solr cluster, and my index 'demo' have 4
shards, Solr assigned one shard on each node evenly by default. But after
we used 'UTILIZENODE' against a new node, all the shards will be put on
Node1. This will make one of the node have heavy workload while other nodes
have no work to do.

So the problem is 'UTILIZENODE' only cares if each node have the same
number of replicas, but it won't try to distribute each index's
replica/shard to as many nodes as possible.
Any thoughts? Thanks.

Regards,
Radar


On Tue, Feb 4, 2020 at 5:20 PM Yuan Zhao <yu...@pivotal.io> wrote:

> Hi Team,
>
> We are using autoscaling policy, we make use of the utilize node feature to
> move replica to new nod.
> But we found after replica are moved, solr can make sure the repilica
> belongs to a same shard located
> on different nodes,  but it can not make sure shard distributed evenly on
> all the nodes.
> That means a node might contain all the shards of an index.
> And, more remarkable, the shards distributed evenly before utilize node
> command is executed.
>
>    index_name  | replica_name | shard_name |          node_name           |
> replica_state
>
> ---------------+--------------+------------+------------------------------+---------------
>  test_index.t2 | core_node6   | shard1     | test-server:8983_solr        |
> active
>  test_index.t4 | core_node7   | shard2     | test-server:8983_solr        |
> active
>  test_index.t4 | core_node5   | shard1     | test-server:8983_solr        |
> active
>  test_index.t2 | core_node4   | shard0     | test-server:8983_solr        |
> active
>  test_index.t1 | core_node3   | shard1     | test-server:8984_solr        |
> active
>  test_index.t4 | core_node8   | shard2     | test-server:8984_solr        |
> active
>  test_index.t3 | core_node8   | shard1     | test-server:8984_solr        |
> active
>  test_index.t2 | core_node2   | shard0     | test-server:8984_solr        |
> active
>  test_index.t2 | core_node10  | shard1     | test-server:8985_solr        |
> active
>  test_index.t1 | core_node18  | shard2     | test-server:8985_solr        |
> active
>  test_index.t4 | core_node10  | shard1     | test-server:8985_solr        |
> active
>  test_index.t3 | core_node10  | shard0     | test-server:8985_solr        |
> active
>  test_index.t1 | core_node14  | shard2     | test-server:8987_solr        |
> active
>  test_index.t3 | core_node14  | shard0     | test-server:8987_solr        |
> active
>  test_index.t3 | core_node12  | shard1     | test-server:8987_solr        |
> active
>  test_index.t1 | core_node16  | shard1     | test-server:8987_solr        |
> active
>
>  Do you have any good solution to this problem.
>  The solr version we are using is 7.4.
>  The cluster policy like:
>  {
> "set-cluster-policy" : [{
>  "replica" : "<2",
>  "shard" : "#EACH",
>  "node" : "#ANY",
>  "strict" : false
> }]
> }
>
> --
> Thanks & regards,
> Yuan
>