Home > Back-end >  Mongodb Primary shard cluster down
Mongodb Primary shard cluster down

Time:08-29

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.

CodePudding user response:

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.

CodePudding user response:

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.

  • Related