Enter your keyword

Backup and Restore

Backup and Restore

Backup and Restore a copy of the database in MongoDB
(MongoDB v4.0.x and earlier)
NOTE: This process is for restoring the database for the same version of the Ping. The Ping installer will handle the upgrade of the database from a previous version (released from Ping version 2019.03.02 SR1 onwards)

Backup the database

  • stop the Ping services.
  • access to the Ping server with a remote desktop session
  • download this zip file and extract it to a folder in the C:\Ping <version>\server\ folder. You can call it as you like but in this example it will be called dbClone.
  • open the dbUpgradeConfig.json in a text editor and update the sourceDb and newDb values:
    • sourceDb = the name of the database which you want to make a copy of.
    • newDb = the name of the copy/backup which must be different from any other databases, e.g. add a manual timestamp ‘pingalerting_YYYYMMDD_HHMMSS’
    • save this file
  • run the db clone process.
    • open a command line
    • change directory to the folder where these files sit, type cd C:\Ping <version>\server\dbClone and press enter
    • run the dbClone.js, type node dbClone.js and press enter
    • once it finished click ctrl+c to end the program
    • close the command window
  • check the copy of the database has been made using following command line steps (or a GUI tool such as Robo 3T or MongoDB Compass)
    • open a command window
    • change directory to the folder where MongoDB is installed, e.g. C:\Program Files\MongoDB\Server\4.0\bin and press enter
    • enter mongo and press enter
    • enter show dbs and press enter to see a list of databases in your MongoDB server.
  • restart the Ping services

 

Restore the database
NOTE: these steps assume you have the downloaded zip file from the backup steps above

  • stop the Ping services
  • drop the existing pingalerting database using Mongo Shell command line script
    • open a command window
    • change directory to the folder where MongoDB is installed, e.g. C:\Program Files\MongoDB\Server\4.0\bin and press enter
    • enter mongo and press enter
    • enter show dbs and press enter to see a list of databases in your MongoDB server
    • enter use <database name> to switch to the database you wish to drop
    • enter db.dropDatabase() to drop the database.
    • enter show dbs and press enter to see a list of databases in your MongoDB server and validate that the dropped database is not in the list.
  • in windows explorer open the dbClone folder which you used to make the backup
  • open the dbUpgradeConfig.json in a text editor and update the sourceDb and newDb values:
    • sourceDb = the name of the backup database which you want to restore. e.g. ‘pingalerting_YYYYMMDD_HHMMSS’
    • newDb = pingalerting
    • save this file
  • run the db clone process.
    • open a command line
    • change directory to the folder where these files sit, type cd C:\Ping <version>\server\dbClone and press enter
    • run the dbClone.js, type node dbClone.js and press enter
    • once it finished click ctrl+c to end the program
    • close the command window
  • you can validate that the pingalerting database exists by using mongo Shell command line script
    • open a command window
    • change directory to the folder where MongoDB is installed, e.g. C:\Program Files\MongoDB\Server\4.0\bin and press enter
    • enter mongo and press enter
    • enter show dbs and press enter to see a list of databases in your MongoDB server
  • restart the Ping services