Hi Shawn,thanks for your reply,

The following is my cluster status. The maxShardsPerNode configuration is 1, 
but I created a collection search1. Both replicas of shard1 are assigned to 
192.168.52.164:8280_solr this node.

Could this be a bug?

{
  "responseHeader":{
    "status":0,
    "QTime":2},
  "cluster":{
    "collections":{
      "search1":{
        "pullReplicas":"0",
        "replicationFactor":"2",
        "shards":{
          "shard1":{
            "range":"80000000-ffffffff",
            "state":"active",
            "replicas":{
              "core_node7":{
                "core":"search1_shard1_replica_n1",
                "base_url":"http://192.168.52.164:8280/solr";,
                "node_name":"192.168.52.164:8280_solr",
                "state":"active",
                "type":"NRT"},
              "core_node8":{
                "core":"search1_shard1_replica_n2",
                "base_url":"http://192.168.52.164:8280/solr";,
                "node_name":"192.168.52.164:8280_solr",
                "state":"active",
                "type":"NRT",
                "leader":"true"}}},
          "shard2":{
            "range":"0-7fffffff",
            "state":"active",
            "replicas":{
              "core_node5":{
                "core":"search1_shard2_replica_n3",
                "base_url":"http://192.168.52.164:8480/solr";,
                "node_name":"192.168.52.164:8480_solr",
                "state":"active",
                "type":"NRT",
                "leader":"true"},
              "core_node6":{
                "core":"search1_shard2_replica_n4",
                "base_url":"http://192.168.52.164:8580/solr";,
                "node_name":"192.168.52.164:8580_solr",
                "state":"active",
                "type":"NRT"}}}},
        "router":{"name":"compositeId"},
        "maxShardsPerNode":"1",
        "autoAddReplicas":"false",
        "nrtReplicas":"2",
        "tlogReplicas":"0",
        "znodeVersion":9,
        "configName":"search"}},
    "properties":{"legacyCloud":"true"},
    "live_nodes":["192.168.52.164:8280_solr",
      "192.168.52.164:8580_solr",
      "192.168.52.164:8180_solr",
      "192.168.52.164:8380_solr",
      "192.168.52.164:8480_solr"]}}




 
From: Shawn Heisey
Date: 2022-01-17 06:08
To: users
Subject: Re: Consult the meaning of maxShardsPerNode
On 1/16/2022 1:07 AM, zhta...@163.com wrote:
> The following is a part of my cluster status
> I configured maxShardsPerNode to 1,but I can still create a collection 
> with 2 shards and 2 replicas each shard on a node(From the web gui).
 
<snip>
 
> Now I'm confused about the meaning of maxShardsPerNode.
 
A setting of maxShardsPerNode=1 means that the collection can only place 
one of its shards on each node.  In actuality it's shard replicas that 
it is referring to.  A 3 shard collection with 2 replicas has a total of 
6 shard replicas.
 
With 5 total nodes, you should probably use maxShardsPerNode=2 when you 
create the collection.
 
I did this on a cloud example created with 4 nodes.  I wanted to try it 
with 5, but the example only allows up to 4.  This is the distribution I 
ended up with:
 
https://www.dropbox.com/s/f41599jqlano4r3/collection_test3x2.png?dl=0
 
Based on this, I think that if you did maxShardsPerNode=2, 3 shards, and 
2 replicas on a 5-node cloud, you would end up with 1 shard replica on 4 
of the nodes, and 2 shard replicas on the fifth.
 
Thanks,
Shawn

Reply via email to