MongoDB Fragmentation best practices.
Q – Does data file fragmentation in MongoDB reduce the amount of data cached in memory Yes, the memory mapping approach used by MongoDB maps files directly to memory. If there is fragmentation in these files, this will be mapped…
MongoDB Triggers ?!!
1) Equivalent to RDBMS triggers in MongoDB ? There is no direct functionality available in MongoDB equivalent to triggers. However, we can achieve similar results using couple of solutions: (a) MongoDB’s “Tailable Cursors” Tailable cursors are conceptually equivalent to the…
MongoDB Monitoring script
#!/bin/bash from=”Alerts@dbversity.com” to=”dbversity@gmail.com” subject=”MongoDB Monitoring Alerts : Long running queries and No. of Open connections” echo ” Hello Team,” > /tmp/email_body.txt echo ” ” >> /tmp/email_body.txt echo “There are long running queries on the MongoDB server, please find attached txt…
Meet Volt, A Promising Ruby Framework For Dynamic Applications
Volt is a Ruby framework designed for data rich applications. Both the server and client sides are written in Ruby (which is then compiled to JS using OPAL), so this allows the developer to write very dynamic applications without having…
How to drain a MongoDB Shard
use dbversity db.dbfry.ensureIndex( { user_id : 1 }, { unique : true }) sh.enableSharding(“dbversity”) sh.shardCollection(“dbversity.dbfry”, {“user_id”:1}) sh.startBalancer() sh.getBalancerState() sh.isBalancerRunning() use dbversity for(var i = 1; i <= 100000 ; i++){db.dbfry.insert({“user_id” : i , “name” : “bulk-inserts”, ” Iteration: ” :…
Command to know Shard distribution from mongos/router
mongos> sh.status() — Sharding Status — sharding version: { “_id” : 1, “minCompatibleVersion” : 5, “currentVersion” : 6, “clusterId” : ObjectId(“568d598d58c8ebe6f4ccaf19”) } shards: { “_id” : “rs1”, “host” : “rs1/dbversity.com:27010,dbversity.com:27011” } { “_id” : “rs2”, “host” : “rs2/dbversity.com:27020,dbversity.com:27021” } {…
Messing with MongoDB Shard Tags ?!! best practices
Question) What will be the expected behavior when we do following 4 cases. We know we should avoid this usage, but still wanted to know what if a user created it mistakenly and wanted to estimate the impact. …
MongoDB WiredTiger File structure & WiredTiger.turtle
The WiredTiger.turtle file contains crucial information required by WiredTiger to understand the other data files. Unfortunately, there is no automated process to recreate this file if you delete it mistakenly, so be very careful with this file. MongoDB WiredTiger Files…
How to get the compression type of a MongoDB collection ?!
To specify compression for specific collections, you’ll need to override the defaults by passing the appropriate options in the db.createCollection() command. For example, to create a collection called “myNewCol” using the zlib compression library: db.createCollection( “myNewCol”, { storageEngine: { wiredTiger:…