Issue
Access Expert On-Premise setup needs procedures and tools to backup and restore the database
Product Line
Access Expert
Environment
-
Access Expert Premise Software V3
-
MongoDB
Cause
The procedures for backing up and restoring the MongoDB is documented online at the link below.
https://docs.mongodb.com/manual/tutorial/backup-and-restore-tools/
However, these instructions do not outline how to use the commands (mongodump and mongorestore) within the Windows OS environment using specific examples.
Resolution
The following procedures are designed to fill in the gap for Access Expert administrators who need to do manual MongoDB Backup and Restore.
These procedures assume that Access Expert V3 has been installed and is functioning normally.
You will need 2 separate Command Prompts, run as Administrator, open for these procedures.
- Mongo DOS Shell to attach to and run commands within MongoDB environment
- Standard DOS Shell to run the Mongo backup and restore commands
MongoDB Backup
- Ensure MongoDB service is running (Start> Run> services.msc)
- Open a Command Prompt as Administrator (referred to as the Mongo DOS Shell)
Type mongo(command)
Type show dbs (command) - shown above, to give a list of the dbs available)
If the MongoDB service is "Running," but the client cannot connect when typing mongo, it's probably because the path to the mongo bin folder hasn't been added to the PC's environment.
To Add a local path locations variable to a PC environment
https://docs.microsoft.com/en-us/previous-versions/office/developer/sharepoint-2010/ee537574(v%3Doff...
Ex. C:\Program Files\MongoDB\Server\3.6\bin (This will vary based on the version of Mongo) - Open another Command Prompt as Administrator (Standard DOS Shell)
Use the CD command to navigate to where you would like the backup files to be created
Ex. C:\Data
mongodump (command)
The mongodump command creates the dump folder with admin, Keep, Signalr subfolders
MongoDB Restore
- In the (Mongo DOS Shell) Prompt
show dbs (command) - use Keep (command) (Case sensitive)
- db.dropDatabase() (command)
- Use the Command Prompt as Administrator (Standard DOS Shell)
mongorestore (command)
The window should indicate "Finished Restoring Keep.Events," "done" and RESTORE COMPLETE
If there are “E11000 duplicate key error collection” Keep.Events errors, it’s because the collection events are already in the folder and need to be deleted first.
Steps to correct the E11000 duplicate issue: (Stop the service, delete and recreate the DB folder, restart service)
- Right-click on the MongoDB service and Stop (you can’t delete files while the service is running)
- Delete C:\Data\db folder (not the Data, only DB)
- MANUALLY CREATE THE DB FOLDER - Right Click > New Folder and name it DB
- Restart the MongoDB service - this creates the necessary files in the DB folder
- Once these steps have been done, rerun the mongorestore command
mongorestore (command) - Verify that users can log into Access Expert with this database