How to increase or decrease the number of mongodb shards deployed via helm bitnami/mongodb-sharded?

2/16/2020

I have deployed mongodb sharded cluster in kubernetes. via: helm install my-release bitnami/mongodb-sharded with default features of 2 shards and only 1 replica per shard.

It is running fine but now I must increase the total number of shards to 4 and each shard replica to 3. Any idea how to do that?

-- Prata
bitnami
kubernetes
kubernetes-helm
mongodb
sharding

1 Answer

2/17/2020

If I recall correctly you can make those changes using command line:

$ helm install my-release --set shards=4, configsvr.replicas=3 bitnami/mongodb-sharded

As for replicas it depends what exactly your want to scale, you can choose from following:

configsvr.replicas

Number of nodes in the replica set (the first node will be primary)

or

mongos.replicas

Number of Mongos nodes to create

or

shardsvr.dataNode.replicas

Number of nodes in each shard replica set (the first node will be primary)

or

shardsvr.arbiter.replicas

Number of arbiters in each shard replica set (the first node will be primary)

Everything is described in Installing the Chart

-- Crou
Source: StackOverflow