Upgrading from MongoDB 4.0 Community Edition¶
Note
MongoDB creates a user that belongs to two groups, which is a potential
security risk. This is fixed in Percona Server for MongoDB: user is included only in the
mongod
group. To avoid problems with current MongoDB setups, existing
user group membership is not changed when you migrate to Percona Server for MongoDB. Instead, a
new mongod
user is created during installation, and it belongs to the
mongod
group.
An in-place upgrade is done with existing data in the server. Generally speaking, this is stopping the server, removing the old packages, installing the new server and starting it with the same data files. While an in-place upgrade may not be suitable for high-complexity environments, it should work in most cases.
Warning
Before starting the upgrade process it is recommended to perform a full backup of your data.
The upgrade process depends on the distribution you are using:
Upgrading on Debian or Ubuntu¶
Run the following commands as root or by using the sudo command
Important
Before you start the upgrading, update the MongoDB configuration file
(/etc/mongod.conf
) to contain the following settings. Otherwise the
mongod service will not be able to start.
processManagement:
fork: true
pidFilePath: /var/run/mongod.pid
Stop the mongod process:
service mongod stop
Check for installed packages:
dpkg -l | grep mongod
Output
ii mongodb-org 4.0.4 amd64 MongoDB open source document-oriented database system (metapackage) ii mongodb-org-mongos 4.0.4 amd64 MongoDB sharded cluster query router ii mongodb-org-server 4.0.4 amd64 MongoDB database server ii mongodb-org-shell 4.0.4 amd64 MongoDB shell client ii mongodb-org-tools 4.0.4 amd64 MongoDB tools
Remove the installed packages:
$ apt-get remove mongodb-org mongodb-org-mongos mongodb-org-server \ $ mongodb-org-shell mongodb-org-tools
Install Percona Server for MongoDB using apt.
Upgrading on Red Hat Enterprise Linux or CentOS¶
Run the following commands as root or by using the sudo command
Important
Before you start the upgrading, update the MongoDB configuration file
(/etc/mongod.conf
) to contain the following settings. Otherwise the
mongod service will not be able to start.
processManagement:
fork: true
pidFilePath: /var/run/mongod.pid
Stop the mongod process:
service mongod stop
Check for installed packages:
rpm -qa | grep mongo
Output
mongodb-org-mongos-4.0.4-1.el6.x86_64 mongodb-org-shell-4.0.4-1.el6.x86_64 mongodb-org-server-4.0.4-1.el6.x86_64 mongodb-org-tools-4.0.4-1.el6.x86_64 mongodb-org-4.0.4-1.el6.x86_64
Remove the installed packages:
$ yum remove \ mongodb-org-mongos-4.0.4-1.el6.x86_64 \ mongodb-org-shell-4.0.4-1.el6.x86_64 \ mongodb-org-server-4.0.4-1.el6.x86_64 \ mongodb-org-tools-4.0.4-1.el6.x86_64 \ mongodb-org-4.0.4-1.el6.x86_64
Install Percona Server for MongoDB using yum.
Note
When you remove old packages, your existing configuration file is saved as
/etc/mongod.conf.rpmsave
. If you want to use this configuration with
the new version, replace the default /etc/mongod.conf
file. For
example, existing data may not be compatible with the default WiredTiger
storage engine.