skip to Main Content

just wanted to understand a scenario where if primary shard cluster down.

so i have a setup of Mongo database where i have 4 shards running in replicaset.

shard-1 == Server 1 (Primary), shard-1 Server 2 (Secondary), shard-1 - Server 3 (Secondary)
shard-2 == Server 4 (Primary), shard-2 - Server 5(Secondary), shard-2 - Server 6(Secondary)
shard-3 == Server 7 (Primary), shard-3 - Server 8(Secondary), shard-3 - Server 9(Secondary)

i have single database and single collection, so assuming that is distributed across all 3 shards as chunks and balancer is doing it’s job right?

so in such case if shard-1(cluster) goes down, will traffic movement will be normal or will be hampered.

3

Answers


  1. Chosen as BEST ANSWER

    well i was just making a scenario where complete cluster might go down, let's say, i have a cluster in single DC and that DC is down, so i might be in a situation where complete cluster is unavailable, other 2 cluster's are in different DC and so they are up and running well.

    ok, let's try another way, If the primary replica set member of a primary shard goes down, elections will be held, the new primary will be announced and everything is back to normal right?.

    but only in case if cluster have another available nodes, what if the complete cluster goes down?.

    what is the use case of other 2 sharded cluster?.

    or do i have wrong understanding of sharding?.

    also, yes i have enabled sharding on my DB and collection both.


  2. I guess you mix sharding and replication.

    What do you mean by "if shard-1(cluster) goes down"? This means you lose 3 servers at once! Is this a probable situation you like investigate? Then I would say, you did a poor design of your cluster.

    Sharding needs to be enabled on database level and on collection level. Based on the information you provided, no answer can be given.

    Login or Signup to reply.
  3. ok, why i was coming this way, let me tell you my actual problem here, i have 4 shards and all in replicaset.
    when i check sh.status(), i saw below output

    autosplit:
    Currently enabled: yes
    balancer:
    Currently enabled: yes
    Currently running: yes
    Failed balancer rounds in last 5 attempts: 0
    Migration Results for the last 24 hours:
    7641 : Failed with error ‘aborted’, from MCA2 to MCA4
    databases:
    { "_id" : "MCA", "primary" : "MCA2", "partitioned" : true, "version" : { "uuid" : UUID("xxxxxxxxxxxx"), "lastMod" : 1 } }
    xxxxxxx
    shard key: { "xxxxx" : "hashed" }
    unique: false
    balancing: true
    chunks:
    MCA 1658
    MCA2 1692
    MCA3 1675
    MCA4 1670

    so my simple question is if this Primary MCA2 shard goes down, what will happen, will collection(xxxxxx) is inaccessible by application or what?

    also, as per terminology, i have 3 nodes cluster so anyone can go down and other becomes primary for traffic serve, so as long as any of the node is alive in my primary shard is alive and can server traffic to application right?.

    if yes then let’s say complete replicaset is down of primary shard MCA2, what now?

    if no, then what will happen.

    changed the actual value of collection and shard key for security reason to (xxxxxxx)

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search