---
title: Step-2 Upgrading MongoDB
description: This section discusses the steps to upgrade the MongoDB.
component: pingintelligence
version: 5.1
page_id: pingintelligence:pingintelligence_upgrade_guide:pingintelligence_upgrading_mongodb
canonical_url: https://docs.pingidentity.com/pingintelligence/5.1/pingintelligence_upgrade_guide/pingintelligence_upgrading_mongodb.html
revdate: April 3, 2024
section_ids:
  before-you-begin: Before you begin
  about-this-task: About this task
  steps: Steps
  next-steps: Next steps
---

# Step-2 Upgrading MongoDB

This section discusses the steps to upgrade the MongoDB.

## Before you begin

Make sure the following prerequisites are met:

* All ABS instances must be stopped and there should be no reads or writes occurring during the upgrade.

* A backup of all the 3 databases has been taken: `abs_data`,`abs_midata`, `abs_metadata`

* All the MongoDB nodes in the replica set must be online and reachable.

|   |                                                                                                 |
| - | ----------------------------------------------------------------------------------------------- |
|   | It is recommended to retain only 10-days of data in order to facilitate a fast upgrade process. |

## About this task

|   |                                                                                                                                                                                                           |
| - | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|   | Run this upgrade only on one of the ABS nodes. Extract the upgrade scripts from the PingIntelligence upgrade package as explained in [Common upgrade tasks section](pingintelligence_upgrade_guide.html). |

Complete the following steps to upgrade MongoDB:

## Steps

1. On any one of the ABS nodes, create a Mongo upgrade directory:

   ```
   # mkdir <Mongo upgrade directory>
   ```

2. Navigate to `~/pi-tmp/pingidentity/upgrade/mongo` on the machine where you downloaded the upgrade package, and copy the `mongo_upgrade_tool_5.1.tar.gz` package and place it in `<Mongo upgrade directory>` diectory that your created in the previous step..

   ```
   # cd ~/pi-tmp/pingidentity/upgrade/mongo/
   # cp mongo_upgrade_tool_5.1.tar.gz <Mongo upgrade directory>/.
   ```

3. In the `<Mongo upgrade directory>` directory on the ABS node, extract the Mongo upgrade tool:

   ```
   tar xvf mongo_upgrade_tool_5.1.tar.gz
   ```

4. Stop ABS on all nodes by entering the following command.

   ```
   # /<ABS installation path>/pingidentity/abs/bin/stop.sh
   ```

   For example:

   ```
   # /home/pi-user/pingidentity/abs/bin/stop.sh
   ```

   If ABS is running as a service, then run the following command.

   ```
   # systemctl stop pi-abs.service
   ```

   |   |                                          |
   | - | ---------------------------------------- |
   |   | Repeat this procedure for each ABS node. |

5. Edit `config/upgrade.properties` and customize the properties to comply with your environment.

   The purpose of each property is described in the `config/upgrade.properties` file.

6. Place the master key in `config/abs_master.key`.

   The master key is needed to read and deobfuscate the Mongo credentials from the `abs.properties` file on the ABS node.

7. Navigate to the `<Mongo upgrade directory>/pingidentity/mongo_upgrade_tool/`directory and run the mongo upgrade script.

   ```
   # bin/upgrade.sh
   ```

   For example:

   ```
   # bin/upgrade.sh
   please see /var/tmp/mongo_upgrade/pingidentity/mongo_upgrade_tool/logs/upgrade.log for upgrade log
   ```

8. To verify the successful status of the upgrade see the `data/status.json` file.

   A successful upgrade should look like this:

   ```json
   {
     "startTime" : "2022_01_12-10_10_08",
     "endTime" : "2022_01_12-10_10_10",
     "status" : "abs upgrade tool has finished successfully"
   }
   ```

   If the success status is not returned, send the `logs/upgrade.log` logfile to Ping Identity support.

## Next steps

Proceed to [Step-3 Upgrading ABS AI Engine](pingintelligence_upgrading_abs_ai_engine.html). IMPORTANT: Only after successful upgrade of MongoDB, proceed with ABS upgrade.
