🥒
Dill's Knowledge Base
  • Hello World
  • 💻SQL
    • ❌Error Handling
    • 🧀Parameter Sniffing
      • Indexes
      • Query Hints
      • RECOMPILE
      • Branching
      • Memory Grants
      • Summary
      • Bonus
    • SQL Server Buffer Pool
  • 🖱️MongoDB
    • Instructor Led Training
      • DF100
      • DF200
      • DF300
      • DF400
    • MongoDB DBA University
      • DBA Admin Tools
      • DBA Basics
      • Metrics & Monitoring
  • 💻Web Design
    • Oxygen Tips
    • Bricks Builder
      • Tips
      • Discovery Call
      • Utility vs Custom Classes
      • Math Functions
      • Static vs Relative Units
  • Azure
    • AZ-900
      • Benefit of Cloud Computing
      • CapEx, OpEx and Consumption-based
      • Differences Between Cloud Service Categories
      • Identify The Right Service Type
      • Differences Between Types of Cloud Computing
      • Reliability and Predictability
      • Regions and Region Pairs
      • Availability Zones
      • Resource Groups
      • Subscriptions
      • Management Groups
      • Azure Resource Manager
      • Azure ARC
      • Resources Required for VM
      • Benefits and Usage of Core Compute Resources
      • Benefits and Usage of Core Network Resources
      • Public/Private Endpoints
      • Benefits and Usage of Storage Accounts
      • Benefits and Usage of Database Resources
      • Data Movement and Migration Options
      • Benefits and Usage of IoT Services
      • Benefits and Usage of Big Data and Analytics Services
      • Benefits and Usage of AI Services
      • Benefits and Usage of Serverless Technologies
      • Benefits and Usage of DevOps Technologies
      • Functionality of Azure Management Solutions
      • Functionality and Usage of Azure Advisor
      • Functionality and Usage of ARM Templates
      • Functionality and Usage of Azure Monitor
      • Functionality and Usage of Azure Service Health
      • Functionality of Microsoft Defender for Cloud
      • Functionality and Usage of Key Vault
      • Functionality and Usage of Microsoft Sentinel
      • Azure Dedicated Host
      • Defense in Depth
      • Describe the Concept of Zero Trust
      • Functionality and Usage of NSGs
      • Functionality and Usage of Azure Firewall
      • Functionality and Usage of Azure DDoS Protection
      • Explain Authentication and Authorization
      • Functionality and Usage of Azure AD
      • Microsoft Entra Overview
      • Functionality of Conditional Access, MFA and SSO
      • Functionality and Usage of RBAC
      • Functionality and Usage of Resource Locks
      • Functionality and Usage of Tags
      • Functionality and Usage of Azure Policy
      • Governance Hierarchy Constructs
      • Azure Blueprints
      • Describe Microsoft Privacy Statement, OST and DPA
      • Purpose of Trust Center and Azure Compliance Documentation
      • Purpose of Azure Sovereign Regions
      • Factors That Affect Costs
      • Factors to Reduce Cost
      • Functionality and Usage of Azure Cost Management
      • Purpose of Service Level Agreements
    • DP-900
      • Study Cram
    • DP-300
      • Deploy IaaS Soluton with Azure SQL
  • 📦Kubernetes
    • Udemy: Kubernetes for Beginners
Powered by GitBook
On this page
  • Backup Tools
  • Syntax for backup
  • Syntax for restore
  1. MongoDB
  2. MongoDB DBA University

DBA Admin Tools

CLI Tools allow you to Import/Export data, restore backups, and view diagnostics

  • These tools must be installed if on Atlas before using

  1. In the terminal, use the following command to import the public key used by the package management system:

    wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add -

  2. Create a list file for MongoDB:

    echo “deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0 multiverse” | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list

  3. Reload the local package database:

    sudo apt-get update

  4. Install the latest stable version of MongoDB Community Edition:

    sudo apt-get install -y mongodb-org

Backup Tools

Mongodump

  • Can be used as part of a backup strategy

Key things to know..

  • Can back up contents of a simple cluster

  • Suited for transfer of small DBs and or collections from one cluster to another

    • Not good for complicated situations

  • Creates files that are stored in a directory called "dump" in the working directory

  • Can be used on standalone and replica sets, but not sharded clusters

  • handles network partition poorly and does not pick up where it left off on restart

  • provides limited support for PIT restores

  • Does NOT contain index data leading to long restore times

For production quality backup and recovery:

  • MongoDB Atlas

  • MongoDB Cloud Managers

  • Ops Managers

Syntax for backup

  • mongodump <options> <connection-string>

  • When auth is enabled, user must have find priv for each db they are backing up

    • backup role provides required privs for all DBs

  • Useful options include: --out, --db, --collection, --readPreference, --gzip, --archive, --oplog

  • --out

    • changes the default directory

  • --db

    • limits backup to single db

  • --collection

    • limits to single collection

  • --readPreference

    • reduces pressure on primary, but may result in stale data

  • --gzip

    • compresses data

  • --archive

    • collapse all data into a single file

  • --oplog

    • captures incoming write operations during a backup phbase

    • produces an additional bson file at the top of output folder

    • Works only when dumping an entire cluster

      • Not compatible with --db or --collection

    • Backup will fail if another client renames a collection or issues an aggregation with the $out param during the backup phase

    • Only available on Atlas M10 if using Atlas

      • If using atlas, you must specify conn string

Syntax for restore

mongorestore

  • utility that loads data from mongopdump

  • Can be used on standalone and replica sets, but not sharded clusters

  • Must be version compatible between source and target clusters

PreviousMongoDB DBA UniversityNextDBA Basics

Last updated 1 year ago

🖱️