-
Notifications
You must be signed in to change notification settings - Fork 14
MongoDB Upgrade Procedure
Felix Gabler edited this page Nov 9, 2022
·
6 revisions
Always update step by step! The links change depending on the MongoDB version and the operating system version!
In-Depth instructions: https://www.mongodb.com/docs/manual/release-notes/6.0-upgrade-standalone/
- Check feature capabilities are set correctly in authenticated mongo shell
db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )
=> should be old version - Stop mongod:
service mongod stop
Refer to: https://www.mongodb.com/docs/v6.0/tutorial/install-mongodb-on-ubuntu/
- Import public key:
wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | apt-key add -
- Create list file for MongoDB:
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/6.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-6.0.list
- Reload packages:
apt update
- Update MongoDB:
apt install -y mongodb-org
- Check versions of mongo and mongod with
--version
- If this did not update the version, reinstall with:
apt-get purge mongodb-org* && apt install -y mongodb-org
- Download new mongo version into
~/mongodb/sources
:wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-5.0.13.tgz
- Extract
tar xfz mongodb-linux-x86_64-ubuntu2004-5.0.13.tgz && rm mongodb-linux-x86_64-ubuntu2004-5.0.13.tgz
- Update symlink in
~/mongodb
:rm mongo && ln -s sources/mongodb-linux-x86_64-ubuntu2004-5.0.13/ mongo
- Check versions of mongo and mongod with
--version
- Start mongod:
service mongod start
- Set new feature capabilities in authenticated mongo shell
db.adminCommand( { setFeatureCompatibilityVersion: "6.0" } )
- Check feature capabilities are set correctly in authenticated mongo shell
db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )
=> should be new version