MongoDB Cluster (Sharded) Scale In

MongoDB Sharded Cluster Scaling

  • We are implementing scale for our sharded cluster environment wherein we add nodes and add shards to the cluster. Each node has only 3 shards. So for example, our minimum number of nodes is 3, so each node has three shards (shards 1-3 are found in each shard). During scale out, we add 1 node and increase number of shards by 1. Each node will still have three shards (node1: shard1,2,3, node2: shard1,2,4, node3: shard1,3,4, node4: shard2,3,4).

  • Now my problem is how to scale in from 4 nodes to 3 nodes.
    How will we merge data from shard 4 to shards1-3?
    Is this possible?

Welcome to the MongoDB community @Ralph_Anthony_Plante!

The MongoDB server documentation includes procedures for Removing Shards from an Existing Cluster, including rebalancing of sharded collections and migration of unsharded collections.

For general automation of self-managed deployments, you may want to consider using MongoDB Cloud Manager (cloud service for automation, backup, and monitoring of self-managed deployments) or MongoDB Ops Manager (fully on-premise equivalent of Cloud Manager). Either of these management tools provide APIs (and UIs) to manage multiple MongoDB deployments.


1 Like