04 - MongoDB Adminstration & Upgrade
04 - MongoDB Adminstration & Upgrade
Administration &
Upgrade
Raheel Khan
23/09/2021
© 2021 The Sage Group plc, or its licensors. All rights reserved.
Contents
• What is Mongo DB
• Mongo DB Administration
• The Mongo DB Config File
• Useful tools (Robo 3T & Mongo Compass)
• Useful MongoDB commands
• Inbuilt MongoDB Performance monitoring tools
• Backing up your Mongo DB
• MongoDB Dump Vs Mongo Export
• The backup Steps
• Upgrading Mongo DB
• From MMAPV1 to Wired Tiger Storage engine
• Sage X3 Prerequisites
• The Upgrade Steps
• Demo a upgrade 4.0 to 4.2
• Q&A
© 2021 The Sage Group plc, or its licensors. All rights reserved. 2
What is
• Mongo DB is a “no SQL” or “not only SQL” database. No SQL databases come in a variety of different types based on
different data models. The main types being document, key-value, wide-column and graph. Mongo DB is an example of
a document orientated database.
• Community – Most commonly used version with Sage X3 it supports the basic features (engine, tools &
replication) and is shipped with Sage Mongo DB Installer
• Enterprise – Is a paid edition the same as the community edition but also has advanced authentication features
like LDAP & Kerberos, as well as additional memory & auditing options.
• Atlas - This is the cloud/hosted offering by MongoDB currently not supported by Sage X3
• In MongoDB, data is stored as documents. These documents are stored in MongoDB in JSON (JavaScript Object
Notation) format. JSON documents support embedded fields, so related data and lists of data can be stored with the
document instead of an external table.
• All or at least most of the Syracuse administration data in Sage X3 is stored and managed in Mongo DB like user
preferences including passwords, endpoint definition , batch server preferences and others.
© 2021 The Sage Group plc, or its licensors. All rights reserved. 3
Mongo DB Administration
SystemLog: This section contains the path of the log file and
verbosity level as well as the log append settings (you can
have a new log file each time the service restarts)
More detailed information about config file setting can be found at https://docs.mongodb.com/manual/reference/configuration-options
© 2021 The Sage Group plc, or its licensors. All rights reserved. 4
Useful tools for use with Mongo DB
Robo 3T formally known as Robo Mongo is a free tool available from https://robomongo.org/download there is also a paid
version Studio 3T available that gives more features like allowing you to use traditional SQL queries it includes a drag and
drop query builder and has inbuilt export features and more.
© 2021 The Sage Group plc, or its licensors. All rights reserved. 5
Once connected with Robo 3T
We can see our Syracuse database and all 77 collections (note the
collections will vary according to the version. Here we can see the
user collection output and you can perform CRUD operations.
© 2021 The Sage Group plc, or its licensors. All rights reserved. 6
MongoDB Compass
Is a GUI for MongoDB Instances available from https://www.mongodb.com/try/download/compass, it will allow you to query and
explore your MongoDB data in a visual environment. You can interact with your data with full CRUD functionality, without having
advanced knowledge of the MongoDB query language. Connecting to Mongo DB Compass in essence is the same as Robo 3T
you need to provide the authentication type and the certificate information.
Overview of the collections,
Overview of Total DBS & with Robo 3T you would have
Collections to query your instance to get
this info.
Edition and
version info
© 2021 The Sage Group plc, or its licensors. All rights reserved. 8
MongoDB Performance Monitoring tools
MongoDB has its own command line performance monitoring tools you can use for monitoring performance or investigating
poor MongoDB performance. These are all located in the MongoDB BIN directory.
• MongoTop - Allows you to track the amount of time an instance spends reading and writing data, the results are per
collection
© 2021 The Sage Group plc, or its licensors. All rights reserved. 9
MongoDB Performance Monitoring tools
• MongoStat – Provides an overview of the currently running instance
Example Syntax
More detailed information about MongoDB database tools can be found at https://docs.mongodb.com/database-tools/
© 2021 The Sage Group plc, or its licensors. All rights reserved. 10
Useful Mongo Commands & Queries
Check our Mongo DB Compatibility level db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )
• You can check your database compatibility level some features in version 4.0 may not be compatible with a compatibility level of 3.0
We can also query Mongo DB documents some basics to get you started (all methods are case sensitive)
Select * from user table where login like admin in SQL db.getCollection('User').find({'login':'admin’})
© 2021 The Sage Group plc, or its licensors. All rights reserved. 11
Backing up your MongoDB Instance
There are two tools available to backup your Mongo DB databases MongoDump & MongoExport.
• MongoDump – Creates a Binary export of the database contents, data in BSON format
For backup purposes we should avoid using the MongoExport and MongoImport Method. MongoExport does not reliably
preserve all rich BSON data types, because JSON can only represent a subset of the types supported by BSON
Backup Steps
• Stop Sage X3 Agent Syracuse Server Service and make sure all node.exe processes have stopped
• Extract database using MongoDump you can use the investigation scripts
© 2021 The Sage Group plc, or its licensors. All rights reserved. 12
Upgrading Mongo DB
From V4.2 MongoDB uses the WiredTiger storage engine and MMAPv1 engine is deprecated . This means if your existing Mongo DB instance
is using MMAPV1 then you will need to convert this data to the new format by exporting & importing your database, to an instance that already
uses the WiredTiger format. The data is converted on import.
You can find out more information on this method of upgrading to the WiredTiger engine from the KB article additional notes when upgrading to
MongoDB 3.6 from 3.4.
Mongo DB Prerequisites can be found on Sage City in the Sage X3 latest patches pages for V11 & V12
https://www.sagecity.com/gb/sage-x3-uk/f/sage-x3-uk-announcements-news-and-alerts/147993/sage-x3-latest-patches
Keep in Mind
• To upgrade from a version earlier than the 3.6-series, you must successively upgrade major releases until you reach the required version
example path 3.4.16 -> 3.6.18 -> 4.0 -> 4.2
• To upgrade an existing MongoDB deployment to 4.0, you must be running a 3.6-series release.
• Check your storage engine before upgrading to 4.2 where MMAPv1 is deprecated
• You must know the server passphrase as the installer does not validate this when upgrading
© 2021 The Sage Group plc, or its licensors. All rights reserved. 13
Upgrading MongoDB the steps 4.0 to 4.2
1. Stop Sage X3 Agent Syracuse Server Service using Services.msc
2. Using Windows Task manager make sure all node.exe processes have stopped
4. Check the out directory specified to confirm that you have extracted JSON & BSON files for each collection these will be
created in a folder named Syracuse (the MongoDB name (Syracuse) in the case of Sage X3
6. Check the Storage Engine used by your instance and convert if necessary, using db.serverStatus().storageEngine
8. Check your feature compatibility version The 4.0 instance must have featureCompatibilityVersion set to 4.0. To check
db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } ) when upgrading from 4.0 to 4.2, the 4.0
instance must have "featureCompatibilityVersion" set to 4.0.
9. Update Mongo DB to 4.2, Execute the installer mongo-db-4.2.12.10.jar follow the same steps as the original install
11. Once the upgrade is complete start the Agent Syracuse service and perform your tests.
© 2021 The Sage Group plc, or its licensors. All rights reserved. 14
DEMO Upgrade of 4.0 to 4.2
© 2021 The Sage Group plc, or its licensors. All rights reserved. 15
Useful Links
Mongo DB Links Sage knowledgebase links
Mongo DB configuration file options How to duplicate or clone a Syracuse environment from a server to another server
MongoDB database tool documentation MongoDB Service will not Start after Upgrade to 3.6.14
© 2021 The Sage Group plc, or its licensors. All rights reserved. 16
Thank you Q&A
©2021 The Sage Group plc or its licensors. All rights reserved. Sage, Sage logos, and Sage product and service names mentioned herein
are the trademarks of Sage Global Services Limited or its licensors. All other trademarks are the property of their respective owners.