HCP Database Backup and Restore

This document will cover the process in how to backup and restore the Humly Control Panel database. It is strongly recommended to create a backup copy of the database before manually editing the database contents.

In this article you will find support for

  1. Create Backup of Humly Control Panel Database on Windows
  2. Create Backup of Humly Control Panel Database on Linux
  3. Restore Database backup to Humly Control Panel on Windows
  4. Restore Database backup on Humly Control Panel on Linux

Create Backup of Humly Control Panel Database on Windows

  1. Start two PowerShell consoles as an administrator and change the directory in both to the MongoDB bin directory, the default path for MongoDB below, however, this might differ if MongoDB has been installed in a customized location. 
    C:\Program Files\MongoDB\Server\4.2\bin
    mceclip0.png 
  2. Go to services and stop HCP service.mceclip1.png
  3. Stop MongoDB Server service.
  4. In one of the PowerShell consoles, start MongoDB by this command.
    ./mongod --dbpath ..\data
    mceclip2.png
    Leave this PowerShell window opened, you can minimize it if you want.
  5. Switch to the second PowerShell window, and write this command.
    ./mongodump
    The output should be similar to this screenshotmceclip4.png

  6. The Database backup is done and the dump is stored in a subfolder under the bin folder. mceclip5.png
    Note: Repeating the above process will overwrite the existing backup.

Create Backup of Humly Control Panel Database on Linux

  1. Change directory to Humly Control Panel installation folder.
    mceclip6.png
  2. Start the DB backup script by writing this command.
     sudo bash backupdb.sh
    The output should look like the below screenshot and the location of the backup will be reported by the end of the script. mceclip8.png

Restore Database backup to Humly Control Panel on Windows

Steps 1 to 3 are the exact same steps in creating a Database backup on Windows.

  1. Start two PowerShell consoles as an administrator and change the directory in both to the MongoDB bin directory, the default path for MongoDB below, however, this might differ if MongoDB has been installed in a customized location. 
    C:\Program Files\MongoDB\Server\4.2\bin
    mceclip0.png 
  2. Go to services and stop HCP service.mceclip1.png
  3. Stop MongoDB Server service.
  4. In one of the PowerShell consoles, start MongoDB by this command.
    ./mongod --dbpath ..\data
    mceclip2.png
    Leave this PowerShell window opened, you can minimize it if you want.

  5. Copy the dump folder into a subfolder under the bin in MongoDB installation
    C:\Program Files\MongoDB\Server\4.2\bin\dump
    On the second PowerShell window, start the restore process by writing this command.
    mongorestore --drop dump\
    The output should look like the screenshot below: 
    mceclip9.png
  6. Close the PowerShell windows by using Ctrl+C on both windows, Start HCP service from windows services msc.

 

Restore Database backup on Humly Control Panel on Linux

  1. Change directory to Humly Control Panel installation folder.
    mceclip6.png
  2. Start the DB restore script by writing this command.
     sudo bash restoredb.sh
    The output should look like the below screenshot:
    mceclip10.png
    You will be asked by the end of the script if you want to keep the backup files or delete them.
    mceclip11.png
    After MongoDB service and HCP service will be restarted automatically. 
    mceclip12.png