openfoodfacts / openfoodfacts-infrastructure

Where we collaboratively plan and maintain the infrastructure of Open Food Facts
3 stars 6 forks source link

Upgrade MongoDB from 4.0 to 4.4 #16

Closed stephanegigandet closed 3 years ago

stephanegigandet commented 3 years ago

From @syl10100:

""Prior to MongoDB 4.4, MongoDB returned an error if a blocking sort operations required more than 32 megabytes of system memory. Starting in MongoDB 4.4, blocking sort operations increase the limit on system memory to use for the sort operation to 100 megabytes. For blocking sort operations which require more than 100 megabytes of system memory, MongoDB returns an error unless the query specifies cursor.allowDiskUse() (New in MongoDB 4.4)."

So the limit is 32MB for our current version (4.0.17) and 100MB for the last one (4.4). Is it planned to upgrade mongodb ?"

stephanegigandet commented 3 years ago

Testing on the dev server.

MongoDB needs to be updated first from 4.0 to 4.2, and then 4.2 to 4.4.

https://docs.mongodb.com/manual/release-notes/4.2-upgrade-standalone/

https://docs.mongodb.com/v4.2/tutorial/install-mongodb-on-debian/

wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -
echo "deb http://repo.mongodb.org/apt/debian stretch/mongodb-org/4.2 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list
apt-get update
systemctl stop mongod
apt-get install -y mongodb-org
apt-get install mongodb-org-mongos mongodb-org-server mongodb-org-shell mongodb-org-tools
systemctl start mongod
mongo
db.adminCommand( { setFeatureCompatibilityVersion: "4.2" } )
stephanegigandet commented 3 years ago

Upgrade from 4.2 to 4.4:

https://docs.mongodb.com/manual/release-notes/4.4-upgrade-standalone/

https://docs.mongodb.com/v4.4/tutorial/install-mongodb-on-debian/

wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
echo "deb http://repo.mongodb.org/apt/debian stretch/mongodb-org/4.4 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
sudo apt-get update
sudo apt-get install -y mongodb-org
apt-get install mongodb-org-mongos mongodb-org-server mongodb-org-shell mongodb-org-tools
mongo
db.adminCommand( { setFeatureCompatibilityVersion: "4.4" } )
stephanegigandet commented 3 years ago

https://world.openfoodfacts.dev is now running mongodb 4.4, I didn't notice any issue.

stephanegigandet commented 3 years ago

mongodb on off2 has been upgraded from 4.0 to 4.4 yesterday evening.