If any Command Line tool is open while installing MongoDB tools, you will need to restart the tool.
Backup Steps
RDP to the server as an administrator user
Open a command window as an administrator
Enter the following to change directory:
cd "C:\Program Files\MongoDB\Server\<VERSION>\bin"
If you are using a newer version of MongoDB, or it is located in a different location such as a D:\ drive, then please adjust this accordingly.
Enter the following command, where Backup Name is the identifier for your backup:
mongodump --db=qlikalerting --out="Backup Name"
This will create a new folder in the C:\Program Files\MongoDB\Server\<VERSION>\bin folder called "Backup Name" and will export all of the data from the database into JSON format files.
Zip the new folder and store it for safekeeping
To automate the process:
Use the following code, with adjustments made where needed for your environment.
off
setlocal
rem Get the current date and time for versioning
for /f "tokens=1-3 delims=/ " %%a in ('date /t') do set dt=%%c-%%a-%%b
for /f "tokens=1-2 delims=: " %%a in ('time /t') do set tm=%%a-%%b
rem Combine date and time for the backup name
set BackupName=Backup_%dt%_%tm%
cd "C:\Program Files\MongoDB\Server\4.4\bin"
mongodump --db=qlikalerting --out="%BackupName%"
pause
An example of the output folder name will be: Backup_21-Mon-10_09-51
Make sure to update the MongoDB version as needed. In this example script, the version is '4.4'.
The information in this article is provided as-is and is to be used at your own discretion. Depending on the tool(s) used, customization(s), and/or other factors ongoing support on the solution below may not be provided by Qlik Support.
Restore Steps
RDP to the server as an administrator user
Open a command window as an administrator
Enter the following to change directory:
cd "C:\Program Files\MongoDB\Server\<VERSION>\bin"
If you are using a newer version of MongoDB, or it is located in a different location such as a D:\ drive, then please adjust this accordingly.
Move your backup to a location that is easy to identify and unzip the file so the folder is located here, for example, D:\backups\Backup Name
Enter the following command, where Backup Name is the identifier for your backup:
mongorestore "D:\backups\Backup Name"
Troubleshooting
You must provide the path to the qlikalertingfolder, not the path where the .json and .bson files are located. Here, qlikalertingis the backup folder name.
Example of a wrong path with the resulting error:
Example with the correct path and successful message:
Based on the above example screenshot, the correct path would be: