Posts

Showing posts with the label MongoDB

HowTo: MongoDB Tailable Cursors in Node.js

Image
MongoDB capped collections are great storing volatile information, like access and debug logs. If you need to monitor regular log file, you would probably type something like this in your command line: tail -f /var/log/access_log . Cool thing is that you can do the same with MongoDB capped collections : Capped collections are fixed-size collections that support high-throughput operations that insert, retrieve, and delete documents based on insertion order. Capped collections work in a way similar to circular buffers: once a collection fills its allocated space, it makes room for new documents by overwriting the oldest documents in the collection. Creating a capped collection is easy; so lets create capped collection named log and size of 16MB (the maximum size of BSON object if you did not know): mongo localhost/test > db.createCollection( "log", { capped: true, size: 16777216 } ) Capped collections act like any other collections, but they work in first-in-first-ou...

MongoDB Certified DBA

Image
MongoDB University Offers Comprehensive Exams Worldwide NEW YORK, NY- Nov 6, 2013 - I am very glad to announce that I have earned certification as a MongoDB Certified DBA, Associate Level .  About a month ago, I was offered to try out MongoDB Certified DBA exam as part of a pilot project, invitations only. Before that, I successfully passed both M101 and M102P courses (well that was almost a year ago).  Invitations were sent to a selected group only, and only 150 first were given a chance to try that exam. It was thrilling to receive congratulating email in my inbox today, saying that I have successfully passed this quite difficult exam. Certificate number is 100-000-011 which indicates me being 11th in the world getting this (links to verify will be available little bit later). According to The 451 Group's analysis of LinkedIn® member profiles, MongoDB is the most popular NoSQL database and now accounts for 49 percent of all mentions of NoSQL technologies. The ...

MongoDB Backup Strategies with Write-Heavy Applications

Image
The MongoDB Management Service  Backup announced earlier in May provides excellent backup and restore capabilities for your MongoDB replica set cluster. Setting up MongoDB backup is quite easy: Sign Up for service, Provide credit card details Install and configure agent In ~ 10 minutes your replica set is backed up and backup agent starts transferring the oplog data to backup mothership. Price for snapshot creating and storage is negligible, compared to the price ($2/GB) for oplog processing. For example, previous invoice was $0.89 for 330GB Snapshot storage, $0.65 for 71GB for snapshot create and $155 for 77GB of oplog traffic.  After analyzing my application, I figured out that most of the traffic was caused by two collections: metalog - 1GB capped collection which stores every API request with details opcounters - this stores various opcounters; every minute new document is created and $inc operator increases various counter(s) by one, depending on action, ...

10gen Announces Company Name Change to MongoDB, Inc.

Image
New York—August 27, 2013—10gen, the MongoDB company, today announced it is changing its name to MongoDB, Inc. The new name more closely unifies the open-source database project with the company behind it. The change is effective immediately. “In 2007, 10gen began work on an open-source cloud computing stack. That was the birth of MongoDB, as the data layer of that platform,” said Dwight Merriman, Chairman and Co-founder at 10gen. “When we saw the potential for the database we had built we decided to focus 100% on MongoDB. Thus the company name 10gen and the database name MongoDB were different. With this change, our goal is to get the names back into alignment.” The MongoDB project, and its mongodb.org community website, are unaffected by this change. 10gen will change its corporate website from 10gen.com to mongodb.com . As part of today’s announcement, 10gen Education, which provides free, online training as well as public and private in-person courses, has been rebranded MongoD...

MongoDB: Remove an Arbiter From a Replica Set

Image
Removing an arbiter from MongoDB Replica Set can be quite tricky, and official MongoDB documentation does not say it directly how to do it. I assume that you have auth enabled (just like I have), so lets start with connecting to your ReplicaSet "repl" master as an administrator: mongo mongo.domain.com/admin -u admin -p pass You will see the following prompt: repl:PRIMARY> Type in conf=rs.conf() repl:PRIMARY> conf = rs.conf() { "_id" : "repl", "version" : 8, "members" : [ { "_id" : 0, "host" : "mongo.server.com:27017", "priority" : 2 }, { "_id" : 1, "host" : "mongo1.server.com:27017" }, { "_id" : 2, "host" : "arbiter.server.com:27017", "arbiterOnly" : true }, { "_id" : 3, "host" : "mongo2.server.com:27017" } ] } Now lets adjus...

10gen Announces MongoDB Backup Service

Image
If you are already using MongoDB Monitoring Service, or MMS, the next logical step here is to sign up for their backup service. MongoDB Backup Service MBS is a cloud-based service provided by 10gen for backing up and restoring MongoDB. Engineered for MongoDB, it features point-in-time recovery and is hosted in reliable, redundant and secure data centers. Update - I got access to MongoDB Backup Service and tried it out! Read more below. MongoDB backup, own way Before MBS was there, I spent some time setting up the backup scripts on one of my secondary servers in replica set, and it works very straight forward once set up: create backup archive and store in S3, and keep only 30 days worth of backups. run mongodump --oplog -u user -p pass mongobackups create backup-YYYYMMMDDHH.tar.bz2 file from mongobackups run /usr/bin/s3put to move file to S3 storage delete mongobackups folder Configure S3 storage lifecycle: Move to Glacier 1 day after creation date Expiration (delete)...