MongoDB administration
You configure mongod, manage users and roles, and run a MongoDB server day to day with the import and export tools, logs and basic monitoring.
Level 201 · 16 lessons · 15 practice labs
Lessons
The server
- The mongod configuration file
- Storage: dbPath and WiredTiger
- mongosh scripts
- Starting, stopping and cleanly shutting down the service
- Short task: start a new server with safe defaults
Users and data
- Creating users and roles
- mongoexport and mongoimport
- mongodump and mongorestore basics
- Managing collections: renaming and capped collections
- Managing indexes and building them without downtime
- Short task: move a collection to another database
Monitoring
- Logs and slow operations
- serverStatus and currentOp
- mongostat and mongotop
- Upgrades and the compatibility version
- Capstone: bring an inherited MongoDB server into shape
Practice labs
- Start mongod from a configuration file: Move a server running on command-line options to a YAML configuration file and restart it.
- Move the data directory to a new disk: Move the dbPath from a nearly full disk to a new one with a clean shutdown and confirm the data opens intact.
- Bring up a server after an unclean shutdown: Read the log of a mongod that will not start after a power loss, find the cause and start it without data loss.
- Create a read-only user for an app: Create a user that can only read one database for a reporting app and see a write attempt being refused.
- Weed out over-privileged accounts: List every user's roles on an inherited server and narrow down those that do not need root.
- Design custom roles for teams: Build and test custom roles where support can only update customer status and analysts can only read.
- Export a collection as JSON: Export the products collection with mongoexport and verify the document count matches the source.
- Restore a single collection from a dump: Bring back only the accidentally emptied orders collection from a full mongodump backup.
- Move a collection to another database: Move a live collection to another database with a short pause, keeping its indexes and validation rules.
- Set up a capped collection for logs: Create a capped collection that keeps the last 10 MB of app events and watch old entries drop off.
- Spot unnecessary indexes: Use $indexStats to find indexes never used or covered by another index's prefix, and list them for removal.
- Build an index during busy hours without downtime: Measure the impact of building an index on a collection under load and finish it without stopping the app.
- Find slow operations in the log: Filter operations over 100 ms from mongod's JSON log lines and find the most common collection.
- Find and kill a stuck operation: Use currentOp to find a bulk update running for hours, assess its impact and stop it with killOp.
- Upgrade the server step by step: Upgrade a server by two major versions while managing the compatibility version and run the app tests.
About this course
You configure mongod, manage users and roles, and run a MongoDB server day to day with the import and export tools, logs and basic monitoring.
What you will learn
- The server
- Users and data
- Monitoring
Prerequisites
Finishing the level 101 courses of the same path, or knowing those topics, is enough.
Lab environment
Lessons run in your own Kali Linux terminal in the browser, connected to a private lab network. Nothing to install.
Frequently asked questions
- Is this course right for my level?
- The course is at level 201; it assumes you know the topics of the lower-level courses.
- Is there anything to install?
- No. Every lesson runs in your own lab environment that opens in the browser.
- How do lessons work?
- Each lesson has 8 to 10 steps and a short quiz. Early steps show the command to type, later steps give less help; if two attempts fail, the solution opens.
- Can I try it for free?
- Yes. The first three lessons of every course are free.