Migrating from MongoDB 3.2 (RHSCL-2.2) to MongoDB 3.4 (RHSCL-3.0)

Updated

MongoDB is a high-performance, open source, schema-free document-oriented database. Red Hat Software Collections (RHSCL) 2.2 contains version 3.2 of MongoDB in the rh-mongodb32 Software Collection. RHSCL 3.0 includes MongoDB 3.4 provided by the rh-mongodb34 Collection. See these notes before upgrading to rh-mongodb34.

General Changes

The rh-mongodb34 Software Collection introduces several general changes listed below.

Compatibility Changes

MongoDB 3.4 includes various minor changes that can affect compatibility with previous versions of MongoDB.

  • mongod instances for the shards must explicitly specify its role as a shardsvr
  • Version 3.4 mongos instances cannot connect to earlier versions of mongod instances
  • Sharded clusters no longer support the use of mirrored (SCCC) mongod instances as config servers
  • Deprecated operations (group and aggregate without cursor)
  • Stricter validation of collection and index specifications
  • Privileges of the following built-in roles no longer apply to the local and config databases: readAnyDatabase, readWriteAnyDatabase, userAdminAnyDatabase, dbAdminAnyDatabase. Correspondingly, the clusterManager, clusterMonitor, backup, restore roles include read and write privileges on local and config databases.
  • If a collection is renamed on the sync source while an initial sync is running, the initial sync process fails and restarts to avoid possible data corruption

For detailed compatibility changes in MongoDB 3.4, see the Content from docs.mongodb.com is not included.upstream release notes.

Backwards incompatible features

The following MongoDB 3.4 features are backwards incompatible and require that the version is set to 3.4 using the featureCompatibilityVersion command:

  • Support for creating read-only views from existing collections or other views
  • Index version v: 2, which adds support for collation, decimal data and case-insensitive indexes
  • Support for the decimal128 format with the new decimal data type

For details regarding backward incompatible changes in MongoDB 3.4, see the Content from docs.mongodb.com is not included.upstream release notes.

Upgrading from the rh-mongodb32 to the rh-mongodb34 Software Collection

Note that once you have upgraded to MongoDB 3.4, you cannot downgrade to version 3.2.7 or earlier. You can only downgrade to version 3.2.8 or later.

Important
Before migrating from the rh-mongodb32 to the rh-mongodb34 Software Collection, back up all your data, including any MongoDB databases, which are by default stored in the /var/opt/rh/rh-mongodb32/lib/mongodb/ directory. In addition, see the compatibility changes to ensure that your applications and deployments are compatible with MongoDB 3.4.

To upgrade to the rh-mongodb34 Software Collection, perform the following steps.

  1. Install the MongoDB servers and shells from the rh-mongodb34 Software Collection:

     ~]# yum install rh-mongodb34
    
  2. Stop the MongoDB 3.2 server:

     ~]# systemctl stop rh-mongodb32-mongod.service
    

    Use the service rh-mongodb32-mongodb stop command on a Red Hat Enterprise Linux 6 system.

  3. Copy your data to the new location:

     ~]# cp -a /var/opt/rh/rh-mongodb32/lib/mongodb/* /var/opt/rh/rh-mongodb34/lib/mongodb/
    
  4. Configure the rh-mongodb34-mongod daemon in the /etc/opt/rh/rh-mongodb34/mongod.conf file.

  5. Start the MongoDB 3.4 server.

     ~]# systemctl start rh-mongodb34-mongod.service
    

    On Red Hat Enterprise Linux 6, use the service rh-mongodb34-mongodb start command instead.

  6. Enable backwards-incompatible features:

     ~]$ scl enable rh-mongodb34 'mongo --host localhost --port 27017 admin' --eval 'db.adminCommand( { setFeatureCompatibilityVersion: "3.4" } )'
    

    If the mongod server is configured with enabled access control, add the --username and --password options to mongo command.

Recommendation
It is recommended that after upgrading, you allow your deployment to run without enabling these features for a burn-in period to ensure the likelihood of a downgrade is minimal.

For detailed information about upgrading, see the upstream Content from docs.mongodb.com is not included.MongoDB 3.4 release notes.
For information about upgrading a Replica Set, see the upstream Content from docs.mongodb.com is not included.MongoDB Manual.
For information about upgrading a Sharded Cluster, see the upstream Content from docs.mongodb.com is not included.MongoDB Manual.

Article Type