HOME SCALA & F# JAVA .NET WEB GROOVY & GRAILS ANDROID & IOS NOSQL ARCHITECTURE AGILE & SCRUM AGILE DEVELOPER  
MongoUK: Mathias Stearn on MongoDB Administration
MongoDB Administration
In this talk, Mathias Stearn presents what Ops guys need to know about MongoDB.

Here're some talk notes:
When setting up:
download and untar (thats it)
/data/db or custom --dbpath (use XFS or ext4)
--directoryperdb
startup and shutdown (ctrl-c or SIGTERM)


Getting stats:
db.serverStatus()
db.stats()
db.collection.stats()
http://localhost:28017 (server port + 1000)
http://localhost:28017/_status
mongostat tool

iostat -x 2
atop

Monitoring tool plugins:
Munin ganglia nagios cacti

Code to see stats:
db.foo.drop()
for (var i=400000; i<1000000; i++){
    db.foo.insert({_id: i});
    for (var j=0; j< 10; j++){
        db.foo.findOne({_id: (i-j)});
    }
}
Run in many mongo's to boost perf. Use htop to see where time is going.
Add a big string to show disk util.

Whats going on right now?
db.currentOp()

Use this to have a query slow enough to see:
db.foo.find({$where: 'var i=1000; while(i--); return this.blah != undefined'})

Backup
mongodump / mongorestore (online-backup)
locking or shut down
backup from slave
db._adminCommand({fsync:1, lock:1})
db.$cmd.sys.unlock.findOne()

Replication (Just Do It!)
mongod --master --oplogSize 500
mongod --slave --source localhost:27017 --port 3000 --dbpath /data/slave
local.oplog.$main
seeding a slave from a master (--fastsync)
delayed replication (--slavedelay secs)
db.printReplicationInfo()
db.printSlaveReplicationInfo()

It isn't working!?!?!
check the logs
try connecting from the shell
check http output

Going into production:
distro pkgs (we have them)
init scripts (make sure they shut down cleanly)
--fork
--logpath (internal rotation)
did I mention replication?

When there's something strange
In your server room.
When you get a page
at 2am.
Who you gonna call?


ABOUT MATHIAS STEARN
Mathias Stearn is a Software Engineer at 10gen.
More about Mathias Stearn
PODCAST MONGODB ADMINISTRATION

This session took part at the MongoUK. You can view the other 19 podcasts here.
SPONSORS
MongoDB
CLOUD PODCASTS
Adrian Withy:Milliman, Milliman
Adrian Withy : 23rd Apr 2012
View Podcast: Milliman,
Brendan Sterne:Bazaarvoice, Bazaarvoice
Brendan Sterne : 23rd Apr 2012
View Podcast: Bazaarvoice,
Peter Ledbrook:A cloud for developers: Cloud Foundry, A cloud for developers: Cloud Foundry
Peter Ledbrook : 8th Dec 2011
View Podcast: A cloud for developers: Cloud Foundry,
Chris O Davies:Introduction to User Group and Heroku, Heroku platform
Chris O Davies : 5th Dec 2011
View Podcast: Introduction to User Group and Heroku,
Nicola Tassini:Deploying Java Apps to Heroku, Deploying Java Apps to Heroku
Nicola Tassini : 5th Dec 2011
View Podcast: Deploying Java Apps to Heroku,
John Beynon:The Why, What and How of Heroku, The Why, What and How of Heroku
John Beynon : 5th Dec 2011
View Podcast: The Why, What and How of Heroku,
Dave Gardner:Real Life Cassandra, Cassandra
Dave Gardner : 2nd Nov 2011
View Podcast: Real Life Cassandra,
 :Amjad Khan on Force.com ERD using SchemaSpy, SchemaSpy
: 20th Oct 2011
View Podcast: Amjad Khan on Force.com ERD using SchemaSpy,
 :Simon Goodyear on Making better use of interfaces on the Force.com platform, Interfaces on the Force.com platform
: 20th Oct 2011
View Podcast: Simon Goodyear on Making better use of interfaces on the Force.com platform,
 :Testing on the Force.com Platform, Testing on Force.com
: 20th Oct 2011
View Podcast: Testing on the Force.com Platform,
 :Effective B2C management, B2C management
: 20th Oct 2011
View Podcast: Effective B2C management,
Bruce Durling:Turning Your Org into a Fully Operational Battle Station using ruby and selenium, Fully Operational Battle Station
Bruce Durling : 20th Oct 2011
View Podcast: Turning Your Org into a Fully Operational Battle Station using ruby and selenium,
Simon Waterer:Introduction to Platform MapReduce, Introduction to Platform MapReduce
Simon Waterer : 12th Oct 2011
View Podcast: Introduction to Platform MapReduce,
Nick Telford:Cassandra vs HBase, Cassandra vs HBase
Nick Telford : 5th Sep 2011
View Podcast: Cassandra vs HBase,
Richard Low:Cassandra failure modes, Failure modes
Richard Low : 5th Sep 2011
View Podcast: Cassandra failure modes,
OTHER CLOUD EVENTS
Cloud East 2012, Cloud East 2012
CONFERENCE (1 DAY)
Cambridge, Thursday, June 28th BOOK NOW!
Robert Schneider:Robert Schneider's Mission Critical Service Testing Using soapUI Pro,  Robert Schneider's Service Testing w soapUI Pro
2 DAY COURSE. Featuring Robert Schneider
London, Monday, July 16th
Robert Schneider:Robert Schneider's Mission Critical Service Testing Using soapUI Pro,  Robert Schneider's Service Testing w soapUI Pro
2 DAY COURSE. Featuring Robert Schneider
London, Thursday, September 13th
© Copyright 2003-2011, Skills Matter Ltd
  Web development by You In Control
About Us  Jobs  Find Us  Meeting & Training Rooms  Newsletter  Jobs: Sales Executive  Jobs: Student SkillsCaster  jobs - junior event coordinator  Speed Coding 2011  Open Source Journal  Ticket Raffle  Agile Expert Series  Jobs: Sponsorship Development  jobs: Marketing & Sales Graduate Internship