Monday, January 23, 2017

Mongodb - Admin utilities

(1)Export/Import:
===========
mongoexport -d mydb -c testdata > testdata.json

mongoimport -d mydb -c testdata < testdata.json

(2) mongodump
==========
//mongodump creates "bson" binary formatted dump for all the DBs and it's collections under dump direcotry

(a) command => mongodump

(b) How to convert bsondump to readable json format

bsondump dump/mydb/testdata.bson > testdata.json

(3) Mongostat
===========
// It provides statistics about the runing mongod instances

./mongostat

(4) Mongoperf
===========
Two Modes:
MMF : False - I/O test for NON SAN disks (Default)
----------------------------------------------------------

echo "{nThreads:10, fileSizeMB:100, r:true)" |mongoperf

- Test run with 10 threads, file size 100

MMF : True - I/O Bench marking purpose  (MMF -> Memory Mapped File - Caching enabled)
---------------------------------------------------------

RAID/SAN mode testing

echo "{recSizeKB:8,nThreads:4, fileSizeMB:100, r:true,mmf:true)" |mongoperf
echo "{nThreads:10, fileSizeMB:100, r:true)" |mongoperf


(5) mongofiles
===========

This utility is used for moving files across local to and from mongo GRIDFS storage

Eg:
I have a file called test.lp in my local file system @ /tmp/test.lp and I want o copy this to mongo gridfs then use the below syntax

mongofiles --host localhost:27017 -d mydb put /tmp/test.lp


mongofiles --host localhost:27017 -d mydb list

mongofiles --host localhost:27017 delete /tmp/test.lp

(6) mongos
========
using mongos stands for "mongo db shrad"
It is a routing service for mongo db shrad configuration to locate your data in the shrad configuration
uning shrad config we can partition our data across mongodb shrad nodes and mongos will help to identify the data address when you query.






No comments:

Post a Comment