Implementation Using .autoAddReplicas Trigger

A Trigger named .autoAddReplicas is automatically created whenever any collection has the autoAddReplicas feature enabled.

Only one trigger is sufficient to serve all collections having this feature enabled. The .autoAddReplicas trigger watches for nodes that are lost from the cluster and uses the default TriggerActions to create new replicas to replace the ones which were hosted by the lost node. If the old node comes back online, it unloads the moved replicas and the node is free to host other replicas as and when required.

Since the trigger provides the autoAddReplicas feature for all collections, the suspend-trigger and resume-trigger Autoscaling API commands can be used to disable and enable this feature for all collections in one API call.

Suspending autoAddReplicas for all collections

{"suspend-trigger":{"name":".autoAddReplicas"}}

Resuming autoAddReplicas for all collections

{"resume-trigger":{"name":".autoAddReplicas"}}

Using Cluster Property to Enable autoAddReplicas

A cluster property, also named autoAddReplicas, can be set to false to disable this feature for all collections.
If this cluster property is missing or set to true, the autoAddReplicas is enabled for all collections.

Warning

Deprecation Warning

Using a cluster property to enable or disable autoAddReplicas is deprecated and only supported for back compatibility. Please use the suspend-trigger and resume-trigger API commands instead.