Menu

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)
[10gen]
name=10gen Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686
gpgcheck=0
Mongodb-repo for x86_64 (64-bit)
[10gen]
name=10gen Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64
gpgcheck=0
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)
logpath=/var/log/mongo/mongod.log
port=27017
dbpath=/var/lib/mongo
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
> db.foo.find()
> db.foo.save({a: 1})
> db.foo.find()
{ "_id" : ObjectId("4b8ed53c4f450867bb35a1a9"), "a" : 1 }
> db.foo.update( {a: 1}, {a: 5})
> db.foo.find()
{ "_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 10.0.10.45:27017/test

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

Next
Newer Post
Previous
Older Post

0 comments:

Post a Comment

 
Top