Upgrade without downtime
Upgrade the cluster node by node without stopping service.
Upgrade the cluster to a new version node by node, without stopping service. New features only turn on when every node supports them.
Requirements
- Access to
teseladb adminon a node of the cluster. - The new version's binary on each machine.
One node at a time
Upgrade one node at a time. Stop it and replace its binary; then start it and wait until teseladb admin nodes lists
it as active before moving to the next one. While it is stopped, its ranges keep serving with the replicas on the other nodes, which hold the
majority. When it comes back it catches up on its own. Do not drain it, because draining is for retiring a node.
sudo systemctl stop teseladb
sudo install -m 0755 ./teseladb /usr/local/bin/teseladb
sudo systemctl start teseladb
teseladb admin nodesTurn the new features on
If the release notes say it announces a more recent MongoDB version, turn it on once every node has the new binary.
featureCompatibilityVersion takes MongoDB versions, such as 9.0:
db.adminCommand({ setFeatureCompatibilityVersion: "<MongoDB version>", confirm: true });Check
When you finish, teseladb admin nodes lists every node as active. If you raised featureCompatibilityVersion,
setFeatureCompatibilityVersion answered ok: 1, which it only gives when every node supports that version.
Common problems
- A new feature is not available because
setFeatureCompatibilityVersionis missing or a node still runs the old version.
See also
- Fault tolerance, with what happens while a node is stopped
- Upgrade between versions, what changes with each kind of upgrade