MongoDB Standby Tool

2 minutes read
Edit on GitHub

MongoDB Standby Tool is used to reconfigure some of the MongoDB replica set members to be in a hidden and secondary state. For example, you can have a replica set where members are running in multiple regions for disaster recovery purposes.

SOURCE Copy
Copied
        docker pull ghcr.io/plgd-dev/hub/mongodb-standby-tool:latest
    

A configuration template is available at tools/mongodb/standby-tool/config.yaml.

PropertyTypeDescriptionDefault
log.levelstringLogging enabled from this level."info"
log.encodingstringLogging format. Supported values are: "json", "console"."json"
log.stacktrace.enabledboolLog stacktrace.false
log.stacktrace.levelstringStacktrace from this level."warn"
log.encoderConfig.timeEncoderstringTime format for logs. Supported values are: "rfc3339nano", "rfc3339"."rfc3339nano"

When the tool is started, it is in standby mode by default. In this mode, all members in the replica set are available, and members in the standby list are set as hidden, without votes, priority, and with a delay. All other members are reconfigured as secondary members. You can change the mode to active by setting the mode property to active. In this mode, standby members are set as secondary members with votes, priority, and without delay, and other members are set as hidden, without votes, priority, and with a delay.

PropertyTypeDescriptionDefault
modestringSet the running mode of the tool. Supported modes are "standby" and "active"."standby"
PropertyTypeDescriptionDefault
replicaSet.forceUpdateboolUpdate the replica set configuration with the force flag. More info [here](https://www.mongodb.com/docs/manual/reference/method/rs.reconfig/#std-label-rs-reconfig-method-force).false
replicaSet.maxWaitsForReadyintSet the maximum number of retries for members to be ready.30
replicaSet.standby.members[]stringList of the MongoDB members in the replica set which are used as hidden (mode == "standby") or secondary (mode == "active") members. All other members are reconfigured to the opposite.[]
replicaSet.standby.delaysstringSet the delay for syncing the hidden members with the secondary/primary members.6m
replicaSet.secondary.priorityintUsed to configure the secondary members' priority.10
replicaSet.secondary.votesintSet the number of votes for the secondary members.1

The tool uses the first member in the standby list (replicaSet.standby.members) to connect to MongoDB.

PropertyTypeDescriptionDefault
clients.storage.mongoDB.timeoutstringThe maximum duration for the entire request operation."20s"
clients.storage.mongoDB.tls.enabledboolIf true, use TLS for the connection.false
clients.storage.mongoDB.tls.caPool[]stringFile paths to the root certificates in PEM format. The file may contain multiple certificates.[]
clients.storage.mongoDB.tls.keyFilestringFile path to the private key in PEM format.""
clients.storage.mongoDB.tls.certFilestringFile path to the certificate in PEM format.""
clients.storage.mongoDB.tls.useSystemCAPoolboolIf true, use the system certification pool.false
Note

Note that string types related to time (i.e. timeout, idleConnTimeout, expirationTime) are decimal numbers, each with an optional fraction and a unit suffix, such as “300ms”, “1.5h”, or “2h45m”. Valid time units are “ns”, “us”, “ms”, “s”, “m”, “h”.

Jun 26, 2024

Get started

plgd makes it simpler to build a successful IoT initiative – to create a proof of concept, evaluate, optimize, and scale.

Get Started Illustration Get Started Illustration