Start Building for Free
CircleCI.comAcademyBlogCommunitySupport

Upgrade MongoDB

3 months ago1 min read
Server v4.2
Server Admin
On This Page

MongoDB is a database service used by CircleCI server. This page describes how to upgrade MongoDB to version 4.4.15.

MongoDB 3.6.22 is shipped with CircleCI server 4.2.

Prerequisites

  • Ensure backups have been taken. You will need a backup of MongoDB to restore to in case anything goes wrong during the upgrade progress

  • You are prepared to modify the values.yaml

  • helm upgrade will work from your system to upgrade the cluster

  • MongoDB root password is available

Scripted upgrade

We have created a shell script which may be used to upgrade your cluster’s MongoDB instance here. If you wish, you may use the following instructions to manually upgrade your cluster’s MongoDB

Manual upgrade

1. Upgrade from MongoDB 3.6 to 4.0

  1. Your values.yaml should contain the following snippet:

    mongodb:
      image:
        tag: 3.6.22-debian-9-r38

    To begin the upgrade process, change the tag to 4.0.27-debian-9-r118:

    mongodb:
      image:
        tag: 4.0.27-debian-9-r118
  2. Run helm upgrade to update your installation.

  3. Once the helm upgrade has completed and MongoDB has rolled, you will need to exec into the pod (with the root password handy) to modify the compatibility version. (Be sure to replace <password> with your MongoDB root password.)

    kubectl exec -it mongodb-0 -- mongo -u root -p <password>
    db.adminCommand( { setFeatureCompatibilityVersion: "4.0" } )
  4. You should get a { "ok" : 1 } response from Mongo. Exit out of the MongoDB shell and pod.

2. Upgrade from MongoDB 4.0 to 4.2

  1. Change the tag to 4.2.17-debian-10-r99:

    mongodb:
      image:
        tag: 4.2.17-debian-10-r99
  2. Run helm upgrade to update your installation.

  3. Once the helm upgrade has completed and MongoDB has rolled, you will need to exec into the pod (with the root password handy) to modify the compatibility version. (Be sure to replace <password> with your MongoDB root password.)

    kubectl exec -it mongodb-0 -- mongo -u root -p <password>
    db.adminCommand( { setFeatureCompatibilityVersion: "4.2" } )
  4. You should get { "ok" : 1 } again. Exit out of the shell and pod.

3. Upgrade from MongoDB 4.2 to 4.4

  1. Change the tag one more time to 4.4.15-debian-10-r8:

    mongodb:
      image:
        tag: 4.4.15-debian-10-r8
  2. Run helm upgrade to update your installation.

  3. Once the helm upgrade has completed and MongoDB has rolled, you will need to exec into the pod (with the root password handy) to modify the compatibility version. (Be sure to replace <password> with your MongoDB root password.)

    kubectl exec -it mongodb-0 -- mongo -u root -p <password>
    db.adminCommand( { setFeatureCompatibilityVersion: "4.4" } )
  4. Once you receive { "ok" : 1 }, you have successfully upgraded your MongoDB to 4.4.15.


Suggest an edit to this page

Make a contribution
Learn how to contribute