Upgrade to Pro — share decks privately, control downloads, hide ads and more …

MongoDB Indexing

Sridhar Nanjundeswaran
February 24, 2012
93

MongoDB Indexing

Presented at MongoDB Chicago - Oct 2011

Sridhar Nanjundeswaran

February 24, 2012
Tweet

Transcript

  1. Sridhar Nanjundeswaran, 10gen
    [email protected]
    © Copyright 2010 10gen Inc.

    View full-size slide

  2. Agenda
    • MongoDB and Windows
    • Client on Windows
    • Productions Customers

    View full-size slide

  3. Database on Windows
    • Installing
    • Deploying
    • Monitoring
    • Known issues
    • Building

    View full-size slide

  4. MongoDB on Windows
    • It really works 
    • Server or client or both can be on Windows

    View full-size slide

  5. Database on Windows
    • Current production release is 2.0
    • Prebuilt binaries for 32 and 64 bit
    • Released the same time as other OS’
    • http://www.mongodb.org/downloads
    • 64 bit recommended and to be used in
    production
    • Windows feature set on par with other OS’

    View full-size slide

  6. Installing on windows
    • Unzip package
    • Create c:\data\db to use default directory or
    use –dbpath
    • Start mongod – c:\path>\bin\mongod.exe
    • Same options as in non-Windows
    environment

    View full-size slide

  7. Deploying
    • Usual mongod deployment best practices still
    hold
    • Always run with replica sets for HA and data
    safety
    • Run with journaling
    • Etc.
    • Run your database process as a service

    View full-size slide

  8. mongod.exe as a windows service
    • Inbuilt service support in mongod
    • --install (uses Local System Account)
    • --remove
    • Run as admin in Win7, Win2k8
    • Other options
    • --serviceName
    • --serviceUser
    • --servicePassword
    • Ensure service user has access to dbpath

    View full-size slide

  9. mongos.exe as a windows service
    • No support on mongos.exe currently
    • Can run mongos.exe as a service using
    srvany.exe
    • https://github.com/sridharn/MongoWindows

    View full-size slide

  10. mongo.exe on windows
    • All normal options available
    • Tab completion on the mongo shell works on
    windows as of 2.0

    View full-size slide

  11. Monitoring on Windows
    • Task Manager
    • Quick monitoring
    • Memory shows resident not mapped
    • Perfmon – monitor network, disk i/o etc.
    • Mongostat.exe
    • Wireshark can be used for packet level
    monitoring
    • http://wiki.wireshark.org/Mongo

    View full-size slide

  12. Mongodb on Azure
    • Current POC
    • Single instance
    • http://www.mongodb.org/display/DOCS/MongoDB
    +on+Azure
    • blobs mounted as a cloud drive
    • Use different blobs for logs and data
    • Can safely give access to logs without data
    • RS and Sharding support coming

    View full-size slide

  13. Known Issues
    • --fork does not work
    • Log rotation does not work on windows
    • No inbuilt support for running mongos as a
    windows service

    View full-size slide

  14. Building on windows
    • Source at http://github.com/mongodb/mongo
    • Get prebuilt spidermonkey
    • https://github.com/dwight/vc2010_js
    • Install on the same level as mongo
    • Get prebuilt boost libraries
    • http://www.mongodb.org/pages/viewpageattachm
    ents.action?pageId=12157032
    • Install on root – actual files are at
    c:\boost\boost\...

    View full-size slide

  15. Building on windows contd.
    • Build using Visual Studio 2010
    • …\mongo\db\db_10.sln
    • Great for navigating source code
    • Build using scons
    • Run the right vcvars.bat
    • --64 – for 64 builds
    • Build the c++ driver
    • scons --mongoclient

    View full-size slide

  16. Client on Windows
    • Can connect to server running Windows or
    other OS’
    • Drivers work on Windows (e.g.)
    • C#
    • Python
    • Java
    • Perl

    View full-size slide

  17. .Net and MongoDB
    • Current version is 1.2
    • Full feature C# (.Net) driver from 10gen
    • Written in C# - built in ODM
    • Used from C#, VB, Powershell and F#
    • 2 dlls (Bson and Driver)
    • Works on Mono
    • Download
    • Zip or msi from Language Center
    • Nuget package available

    View full-size slide

  18. .Net and MongoDB contd
    • Source
    • www.github.com/mongodb/mongo-csharp-driver
    • VS2008, VS2010 solutions
    • VS2010 solution works in MonoDevelop (on
    Windows, Linux and OS X)
    • More info
    • http://www.mongodb.org/display/DOCS/CSharp+
    Language+Center
    • API Docs –
    http://api.mongodb.org/csharp/current/

    View full-size slide

  19. Python and MongoDB
    • Current version is 2.0.1
    • Support for Python 2.4, 2.5, 2.6 and 2.7
    • Prebuilt installers at pypi.org for 32 and 64
    bit builds
    • Download appropriate version
    • Works out of the box including C extensions

    View full-size slide

  20. Python and MongoDB contd.
    • Building C extensions
    • Need VS2008 for 2.6 and 2.7
    • For 2.4 and 2.5 use MingW
    • To build 64 bit need full VS (not Express)
    • More info
    • API Docs – http://api.mongodb.org/python/current

    View full-size slide

  21. Java and MongoDB
    • Current version is 2.6.5
    • Pure Java driver
    • ODM – Morphia
    • Download
    • 1 jar file
    • More info
    • http://www.mongodb.org/display/DOCS/Java+Lan
    guage+Center
    • API Docs – http://api.mongodb.org/java/current

    View full-size slide

  22. Perl on Windows
    • Current version is 0.45
    • Use Strawberry perl
    • To install
    • cpan inc::Module::install
    • cpan MongoDB
    • More info
    • http://www.mongodb.org/display/DOCS/Perl+Languag
    e+Center
    • CPAN site -
    http://search.cpan.org/~kristina/MongoDB-
    0.45/lib/MongoDB.pm

    View full-size slide

  23. Production Customers
    • National Archives
    • Migrated from SQL Server to MongoDB
    • Store asset information
    • Pattern Builders
    • Streaming analytics engine (.Net)
    • On Point Medical Diagnostics
    • Ultimate Software
    • HR/Payroll SaaS based (.Net)
    • Struq

    View full-size slide

  24. @mongodb
    © Copyright 2010 10gen Inc.
    conferences, appearances, and meetups
    http://www.10gen.com/events
    http://bit.ly/mongofb
    Facebook | Twitter | LinkedIn
    http://linkd.in/joinmongo
    download at mongodb.org
    We’re Hiring !
    [email protected] @snanjund

    View full-size slide