New in the Community? Get started here

Schneider Electric Exchange Community

Discuss and solve problems in energy management and automation. Join conversations and share insights on products and solutions. Co-innovate and collaborate with a global network of peers.

Register Now
Knowledge Base
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

- Who are the top users of September? Discover them here!

- Check out the ESS Active Energy Management Blog now! 

- Join us on October 23rd for a live Panel session to discuss The Power of a Sustainable Ecosystem with Hervé Coureil, Chief Digital Officer of Schneider Electric and other great speakers. Register here!

Backup and Restore MongoDB for Windows for Access Expert On-Premise

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.

  1. Mongo DOS Shell to attach to and run commands within MongoDB environment
  2. Standard DOS Shell to run the Mongo backup and restore commands

MongoDB Backup

  1. Ensure MongoDB service is running (Start> Run> services.msc)
  2. Open a Command Prompt as Administrator (referred to as the Mongo DOS Shell)
    Type mongo(command)
    MongoCommand.jpg
    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)
    EnvironmentVariables.jpg
  3. 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)
    MongodumpCommand.jpg

The mongodump command creates the dump folder with admin, Keep, Signalr subfolders

dumpFolders.jpg

MongoDB Restore

  1. In the (Mongo DOS Shell) Prompt
    show dbs (command)
    showDBsCommand.jpg
  2. use Keep (command) (Case sensitive)
  3. db.dropDatabase() (command)
    db.dropDatabaseCommand.jpg
    KeepDBdropped.jpg
  4. Use the Command Prompt as Administrator (Standard DOS Shell)
    mongorestore (command)
    MongoRestoreCommand.jpg
    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.

E11000Errors.jpg

 

Steps to correct the E11000 duplicate issue: (Stop the service, delete and recreate the DB folder, restart service)

  1. Right-click on the MongoDB service and Stop (you can’t delete files while the service is running)
    MongoDBserviceStop.jpg
  2. Delete C:\Data\db folder (not the Data, only DB)
    DeleteDataDb1.jpg
    DeleteDataDb2.jpg
  3. MANUALLY CREATE THE DB FOLDER - Right Click > New Folder and name it DB
    DeleteDataDb1.jpg
  4. Restart the MongoDB service - this creates the necessary files in the DB folder
    MongoServiceFileCreation.jpg
  5. Once these steps have been done, rerun the mongorestore command
    mongorestore (command)
    MongoRestoreCommand.jpg
  6. Verify that users can log into Access Expert with this database
Labels (1)
100% helpful (2/2)