Administration

                       Kevin Hanson
           Solutions Architect, 10gen
              twitter: @hungarianhc
                  kevin@10gen.com
http://www.mongodb.org/display/DOCS/Admin+Zone
Supported Platforms

• OS X
• Linux
• Solaris
• Windows
• FreeBSD
The Basics ~ /bin

• mongod: database server
• mongo: shell
• mongos: sharding router
• mongodump: backup tool
• mongostat: monitoring tool
Is it working?

• Logs
• Netstat
• Try Out the Shell
Starting for Real

• distro packages
• --fork
• --logpath
• --quiet
Our Agenda

• Replication
• Monitoring
• Backups
• Queries + Indexes
Replication
Replication & The Oplog

• Replication: Use It!
• Mind the Oplog Size
• Consider Delayed Replication
Replica Sets
•   One Primary, Many Secondaries

•   High Availability ~ Self Healing

•   Strongly Consistent

•   Hidden Nodes, Delayed SECONDARIES

•   Reading from SECONDARIES

        •   If the PRIMARY goes down, can the remaining
            SECONDARIES handle the load?

        •   Are You Okay With Less Up to Date Data?

        •   If the answer to either question is no, stick with
            reading from PRIMARIES...
Replica Sets
           Node 1!                           Node 2!
          Secondary!           Heartbeat+   Secondary!



                                Node 3!
                                Primary!        Replication+
                Replication+


•   Replication is Asynchronous

•   Nodes Can Be in Different Datacenters

•   Tailing the Oplog

•   Monitor Secondary Delay + Oplog Size
A Look at the Oplog
Monitoring
MongoDB Monitoring Service


 • SaaS solution providing instrumentation and
   visibility into MongoDB systems
 • Free version released
 • 5,000+ customers using service
 • Installable Version Coming
MongoDB Monitoring Service
Popular Monitoring Plugins

• munin
• ganglia
• nagios
• cacti
Popular Monitoring Plugins

• munin
• ganglia
• nagios
• cacti
iostat -x 2
mongostat
Backups
Mongodump
• http://docs.mongodb.org/manual/reference/
  mongodump/
• Binary Export
• Best to Run Off Hidden Nodes / Delayed
  Secondaries
Filesystem Snapshots
• Journaling...
 • If turned on, and on the same filesystem,
    snapshot at will.
  • If not on or mounted somewhere else,
    fsync lock required
• Use a filesystem that supports snapshots :-)
Queries / Indexes
Queries + Indexes
Queries + Indexes
•   Note the Cursor Type (Btree vs. Basic)
•   Most Use-Cases: Queries Should be Indexed
•   Force No Table Scans
     •   --notablescan
•   Indexes Should Fit in RAM
•   Indexes Slow Writes
     •   Use them when you need them...
     •   Don’t use them when you don’t...
•   Use the Slow Query Log
Viewing / Killing Ops
Download MongoDB
   http://www.mongodb.org




and let us know what you think
 @hungarianhc @mongodb

MongoDB Administration ~ Kevin Hanson