How to know current storage engine in MongoDB ?
Ideally, db.serverStatus() gives the all the server related information including storage engine details, however below command will specifically tell you the storage engine details. Connect to the respective Replica set member and execute below command. rs1:PRIMARY> db.serverStatus().storageEngine.name wiredTiger OR…
Distributed consensus in MongoDB’s replication system
Distributed Consensus in MongoDB’s Replication System Hi MongoDB User, Take an hour to see how changes to MongoDB’s election protocal will lead to faster elections, more robust systems, and lay the groundwork for new replication features going forward….
MongoDB 3.2 Shard creation script
Below shell script will be useful to create a MongoDB’s sharded environment on a single sever/multiple servers depending on your requirement. Things to remember to execute below automated script. 1) We should have required privileges to the user on your…
MongoDB query to get the stats of all collections in all databases
To collect the stats of all the collections in all databases from a mongo shell, you can run below query. db.getMongo().getDBNames().forEach(function (d) { print(“Database: ” + d ); var curr_db = db.getSiblingDB(d); printjson( curr_db.stats() ); curr_db.getCollectionNames().forEach(function(coll) { print(“.. collection: ”…
MongoDB 3.2 Installation
1) Know your OS version & OS bit type with following commands to download the MongoDB packages. [ root@dbversity.com #]more /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=14.04 DISTRIB_CODENAME=trusty DISTRIB_DESCRIPTION=”Ubuntu 14.04.3 LTS” [ root@dbversity.com #] [ root@dbversity.com #]uname -a Linux srinivas-HP-G62-Notebook-PC 3.19.0-42-generic#48~14.04.1-Ubuntu SMP Fri Dec…
Why odd nodes in MongoDB ReplicaSet ?
https://www.youtube.com/watch?v=mLbMV5RknFY
How to remove a shard from the MongoDB sharded cluster
Removes a shard from a sharded cluster. When you run removeShard, MongoDB first moves the shard’s chunks to other shards in the cluster. Then MongoDB removes the shard. [root@dbversity bin]# ./mongo –port 10000 MongoDB shell version: 2.4.11 connecting to: 127.0.0.1:10000/test…
MongoDB Indexes
MongoDB provides a number of different index types to support specific types of data and queries. Indexes support the efficient execution of queries in MongoDB. MongoDB defines indexes at the collection level and supports indexes on any field or sub-field…
How do we insert image/audio/video files in MongoDB ?
Uploading a video file using GRIDFS with mongofiles utility : mongofiles -d database put video.mp4 mongofiles -d database get video.mp4 mongofiles -d database delete video.mp4 [dbfryusr@dbversity ~]$ ./mongofiles –port 27010 -d shrdb put /home/dbfryusr/MongoDB.mp4 connected to: 127.0.0.1:27010 added file: {…
MongoDB Tag aware sharding – Controlling Collection Distribution
Shard tagging is a new feature in MongoDB version 2.2.0. It’s supposed to force writes to go to a local data center, but it can also be used to pin a collection to a shard or set of shards….