Pritunl update mongodb

I have a Pritunl server on Debian Bullseye and need to upgrade to Debian Bookworm, but my version of MongoDB 3.1.11 seems to be incompatible with the latest Debian. What is the best way to update MongoDB without losing data? Is there a guide available? Has anyone else encountered this situation?

I probably will look at the mongo DB procedure. There’s some issue to pay attention in the pritunl ecosystem?

Thanks.

For example, do I need to set “featureCompatibilityVersion” or not?

Before attempting to upgrade the database run mongodump --db=pritunl. With MongoDB it will require upgrading 1 release at a time starting with MongoDB 3.2 upgrade. This would be about 6 steps from that release. It may be better to export the database as documented in the backup documentation and install the latest MongoDB with an empty database as shown below. Then import the database back and run sudo pritunl destroy-secondary to clear the cache data in the database. Sometimes sudo pritunl repair-database is also needed this will also rebuild the IP pools.

mongodump --db=pritunl
sudo systemctl stop pritunl
sudo systemctl stop mongod
sudo yum remove mongodb-org
sudo rm -rf /var/lib/mongo
sudo rm /etc/yum.repos.d/mongodb-org*
sudo tee /etc/yum.repos.d/mongodb-org-6.0.repo << EOF
[mongodb-org-6.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/7/mongodb-org/6.0/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-6.0.asc
EOF
sudo yum install mongodb-org
sudo systemctl enable mongod
sudo systemctl start mongod
mongorestore dump
sudo systemctl start pritunl
sudo pritunl destroy-secondary
1 Like

I’m on debian and will utilize the .deb package.
The above code should be applied to every version of mongo 3.2 - 3.4 - 3.6 - 4.0 - 4.2 - 4.4 - 5.0 - 6.0 ?

No you would need to search Google or the MongoDB documentation for the upgrade instructions for each of those versions. This should be update the repository file to update the package. Then updating the feature compatibility version.

The commands above can be used to skip to the latest release and import a backup of the database.

1 Like

Excellent. Thanks! I’ll try.

Dear @zach is mongodb 6.0 the suggested version? I’ve read about issue on v.7. Now it’s out version 8.

Thanks

The issue in v7 was fixed several months ago, that is the current release in the documentation. I don’t have v8 on any test systems yet but there shouldn’t be any issues. The new Pritunl builds from this month have the latest pyMongo library and should have no compatibility issues.

4 Likes