What is MongoDB?

MongoDB (from “humongous”) is a scalable, high-performance, open source, schema-free, document-oriented database. Written in C++. MongoDB bridges the gap between key-value stores (which are fast and highly scalable) and traditional RDBMS systems (which provide structured schemas and powerful queries).
MongoDB is very interesting document-oriented database, because it has really awesome features:
  • Document-oriented storage (the simplicity and power of JSON-like data schemas)
  • Dynamic queries
  • Full index support, extending to inner-objects and embedded arrays
  • Query profiling
  • Fast, in-place updates
  • Efficient storage of binary data large objects (e.g. photos and videos)
  • Replication and fail-over support
  • Auto-sharding for cloud-level scalability
  • MapReduce for complex aggregation
  • Commercial Support, Training, and Consulting
This guide shows howto install MongoDB 2.4.4 on Fedora 18/17/16/15/14/13/12, CentOS 6.4/6.3/6.2/6.1/6/5.9 and Red Hat (RHEL) 6.4/6.3/6.2/6.1/6/5.9. Using MongoDB own YUM repositories. Fedora / CentOS / Red Hat (RHEL) RPM packages are currently available for x86 (32-bit) and x86_64 (64-bit) architectures.
Add and enable 10gen MongoDB repository
Select suitable repo for your system and add one of following to /etc/yum.repos.d/10gen-mongodb.repo.
Mongodb-repo for i686 (32-bit)
name=10gen Repository
Mongodb-repo for x86_64 (64-bit)
name=10gen Repository
Install mongo server and mongo client packages
Install stable version of MongoDB.
yum install mongo-10gen mongo-10gen-server
Configure MongoDB Database Server
FEdit /etc/mongod.conf file:
nano -w /etc/mongod.conf
Check and set basic settings, before starting MongoDB (default settings are good)
Start MongoDB Server
[root@hackthesec]# service mongod start
## OR ##
[root@hackthesec]# /etc/init.d/mongod start
[root@hackthesec]# chkconfig --levels 235 mongod on
Start MongoDB Server
Open MongoDB Command Line Client..
[root@hackthesec]# mongo
> use test
switched to db test
>{a: 1})
{ "_id" : ObjectId("4b8ed53c4f450867bb35a1a9"), "a" : 1 }
> {a: 1}, {a: 5})
{ "_id" : ObjectId("4b8ed53c4f450867bb35a1a9"), "a" : 5 }
Open MongoDB Port (27017) on Iptables Firewall (as root user again)
Edit /etc/sysconfig/iptables file:
[root@hackthesec]# nano -w /etc/sysconfig/iptables

Add following line before COMMIT:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 27017 -j ACCEPT
Restart Iptables Firewall
[root@hackthesec]# service iptables restart
## OR ##
[root@hackthesec]# /etc/init.d/iptables restart
Note: Open MongoDB port only if you have enabled authentication or operating trusted environment.
Test remote connection
[root@hackthesec]# mongo server:port/database
## Example ##
[root@hackthesec]# mongo

About Author:

I am a Linux Administrator and Security Expert with this site i can help lot's of people about linux knowladge and as per security expert i also intersted about hacking related news.TwitterFacebook

Newer Post
Older Post


Post a Comment