The document discusses 5 key things to know about administering MongoDB: 1) Understanding MongoDB's architecture and memory usage, 2) Protecting data through replication and deployment strategies, 3) Scaling writes and reads using sharding, 4) Monitoring MongoDB performance using tools like MMS, and 5) Backing up and restoring data with tools like mongodump/mongorestore. It provides examples and explanations of useful commands for tasks like replication, sharding, and monitoring MongoDB deployments.
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Ops Jumpstart: MongoDB Administration 101
1. #MongoDBDays
5 Things you need to know
about Administering MongoDB
Alvin Richards
Senior Director of Performance Engineering, MongoDB
2. #MongoDBDays
Or…
A Dev and Ops "Love Story"
Alvin Richards
Senior Director of Performance Engineering, MongoDB
3. Before we start…
• I'm assuming you have at least
– installed MongoDB
– Have done some basic Admin
• I'm not assuming you have
– Been running in production for any length of time
4. Dev are from Mars and Ops are from
Venus…
DEV OPS
5. 5 Things you need to know
1. Know Thy Beast
2. Protecting data
3. Scaling Writes & Reads
4. Monitoring
5. Backing up & Restoring
7. Architecture
• Shipped as Binaries
• tarball, zip file
• Packages(rpm, yum)
• MSI (for Windows)
• Runs a background process mongod (or
mogod.exe)
• Uses Memory Mapped Files
8. Memory Mapped files – dude whoa
• To MongoDBmemory is an infinite-ish pool
• 64 TB Linux / Windows 2012 R2 / Windows 8.1
• 4 TB earlier Windows versions
• MongoDB accesses memory locations in virtual
memory
• O/S may have to page in that data from storage
• O/S may have to page out data from RAM
• Physical RAM acts as a LRU cache
27. Deployment–Single Data Center
Good
• Automated failover
• Tolerates server failures
• Tolerates rack failures
• Number of replicas
defines failure tolerance
Bad
• Cannot survive loss of
Data Center
Primary – A
Secondary – B
Secondary – C
28. Deployment - Active/Active Data
Center
US-B
Data Center - US
US-A
EU-C
EC-D
ASIA-E
Data Center - Europe Data Center - Asia
Good
• Tolerates server, rack, data center failures, network
partitions
Bad
• Complexity but "MMS Automation to the rescue" ™
45. Shard Key
• What key to use?
• Plain or Hashed?
• What's the distribution & usage?
• Predicate & Sorts
– Use the Shard key?
– Scatter Gather + Sort?
47. Useful commands
// Commands to start/Stop the balancer
> sh.startBalancer()
> sh.stopBalancer()
// Disable balancing for a specific collection
> sh.disableBalancing("students.grades")
// Runt the balancer during a specific time window
> db.settings.update({ _id : "balancer" },
{ $set : { activeWindow : { start : "<start-time>",
stop : "<stop-time>" } } }, true )
49. Immediate vs. Eventual
Consistency
• Do you want to read your own writes?
– Use Sharding to Scale Reads
• Are you tolerant to read older versions of data?
– May read from Secondary's
57. KPIs you care about
• MongoDB
– MongoDB ops/sec
– Read/Write queues
– Index Misses
– Locked %
– Flush times
– Replication Lag
58. KPIs you care about
• Storage
– IOPS
– Size
– Data & Loading Patterns
• Memory
– Working Set
• CPU
– Speed
– Cores
• Network
– Latency
– Throughput
66. #MongoDBDays
Thank You
Alvin Richards
alvin@mongodb.com / @jonnyeight
Senior Director of Performance Engineering, MongoDB
Editor's Notes
Can map this back to the linking versus embedding question.
For an embedded object, the worst case is page fault(s) to read the object, but on disk this will be a seek followed by a sequential read
For a linked objects, the worst case is a page fault for each, which is a disk seek for each linked object
High Availability – Ensure application availability during many types of failures
Disaster Recovery – Address the RTO and RPO goals for business continuity
Maintenance – Perform upgrades and other maintenance operations with no application downtime
Secondaries can be used for a variety of applications – failover, hot backup, rolling upgrades, data locality and privacy and workload isolation
Initialize -> Election
Primary + data replication from primary to secondary
Primary down/network failure
Automatic election of new primary if majority exists
New primary elected
Replication established from new primary
Down node comes up
Rejoins sets
Recovery and then secondary
Add icon/image for resources; use those images/icons for the rest of the slides