Ads 468x60px

For New Update Use this Link Offer for you


Friday, 15 March 2013

Install Mongo on CentOS,Fedora, Ubuntu & Debian

Install MongoDB 2.0.4 on RHEL CentOS Fedora Ubuntu & Debian
This howto guide shows how to install MongoDB 2.0.4 on RHEL 6.2/6.1/6/5.8, CentOS 6.2/6.1/6/5.8, Fedora 16/15/14/13/12, Ubuntu 12.04/11.10/11.04/10.10/10.04 and Debian using MongoDB own YUM repositories for RHEL, CentOS and Fedora and apt-get for Ubuntu and Debian.

What is MongoDB?

MongoDB (from "humongous") is an open source scalable, high-performance and schema-free document-oriented NoSQL database system 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 Features

  1. Document-oriented storage (the simplicity and power of JSON-like data schemas)
  2. Dynamic queries
  3. Full index support, extending to inner-objects and embedded arrays
  4. Query profiling
  5. Fast, in-place updates
  6. Efficient storage of binary data large objects (e.g. photos and videos)
  7. Replication and fail-over support
  8. Auto-sharding for cloud-level scalability
  9. MapReduce for complex aggregation
  10. Commercial Support, Training, and Consulting

Why MongoDB?

  1. Document-oriented
    1. Documents (objects) map nicely to programming language data types
    2. Embedded documents and arrays reduce need for joins
    3. Dynamically-typed (schemaless) for easy schema evolution
    4. No joins and no multi-document transactions for high performance and easy scalability
  2. High performance
    1. No joins and embedding makes reads and writes fast
    2. Indexes including indexing of keys from embedded documents and arrays
    3. Optional streaming writes (no acknowledgements)
  3. High availability
    1. Replicated servers with automatic master failover
  4. Easy scalability
    1. Automatic sharding (auto-partitioning of data across servers)
      1. Reads and writes are distributed over shards
      2. No joins or multi-document transactions make distributed queries easy and fast
    2. Eventually-consistent reads can be distributed over replicated servers
  5. Rich query language
Install MongoDB 2.0.4 on RHEL 6.2/6.1/6/5.8, CentOS 6.2/6.1/6/5.8, Fedora 16-12, Ubuntu 12.04/11.10/11.04/10.10/10.04 and Debian

How to Install MongoDB 2.0.4 RHEL, CentOS and Fedora

Step 1: Adding 10gen MongoDB Repository

Add 10gen Mongodb-repo (yum-installable RPM packages) on RHEL 6.2/6.1/6/5.8, CentOS 6.2/6.1/6/5.8, Fedora 16-12 for x86 and x86_64 platforms.

For all 32-bit RPM-based distros with yum, put this at /etc/yum.repos.d/10gen.repo:
name=10gen Repository
For all 64-bit RPM-based distros with yum, put this at /etc/yum.repos.d/10gen.repo:
name=10gen Repository

Step 2: Installing MongoDB 2.0.4

Installing MongoDB Database Server on RHEL 6.2/6.1/6/5.8, CentOS 6.2/6.1/6/5.8, Fedora 16-12 for x86 and x86_64 platforms using YUM.
yum install mongo-10gen mongo-10gen-server
Note: for users upgrading from older (pre-2/2011) packaging scheme, it may be necessary to uninstall your existing "mongo-stable", "mongo-stable-server", "mongo-unstable", "mongo-unstable-server" packages before installing the latest mongo-10gen, mongo-10gen-server pacakges.

Step 3: Configure MongoDB Database Server

Open and edit /etc/mongod.conf file with VI Editor. Verify and set basic settings, before starting MongoDB Database Server.
vi /etc/mongod.conf

Step 4: Starting MongoDB Database Server

/etc/init.d/mongod start
## OR ##
service mongod start

Step 5: Testing MongoDB Database Server

Testing with MongoDB command line client.

Step 6: Executing MongoDB Basic Commands

> show dbs
> show collections
> show users
> use <db name>

Step 7: Starting & Stopping MongoDB

Here is a quick reference to the commands that control the execution of the mongod server process:
service mongodb status 
service mongodb stop
service mongodb start
service mongodb restart
## OR ##
/etc/init.d/mongod status
/etc/init.d/mongod stop
/etc/init.d/mongod start
/etc/init.d/mongod restart

Step 8: Opening MongoDB Port on Firewall

Open file /etc/sysconfig/iptables and add the following line at the bottom and restart iptables.
-A INPUT -m state --state NEW -m tcp -p tcp --dport 27017 
/etc/init.d/iptables restart
## OR ##
service iptables restart

Step 9: Testing MongoDB Remote Connection

mongo serverip:port/databasename
## Example ##

How to Install MongoDB 2.0.4 on Ubuntu and Debian

Step 1: Adding 10gen MongoDB source.list

The 10gen package contains the latest mongoDB version, add below lines at the bottom of the file “/etc/apt/sources.list” on Ubuntu 12.04/11.10/11.04/10.10/10.04 and Debian.

For Ubunut, put these below lines to “/etc/apt/sources.list”:
dist 10gen
For Debian, put these below lines to “/etc/apt/sources.list”:
dist 10gen

step 2: Adding GPG Key

10gen package required GPG key, import it:
sudo apt-key adv --keyserver --recv 

step 3: Insalling MongoDB

sudo apt-get update 
sudo apt-get install mongodb-10gen

step 4: Starting MongoDB

sudo status mongodb
sudo stop mongodb
sudo start mongodb
sudo restart mongodb

step 5: Testing MongoDB

To verify it, just connect it with “mongo
In case you're facing any difficulties while setting up MongoDB Database Server, please share with us via comment.

No comments:

Post a Comment



New Updates

Related Posts Plugin for WordPress, Blogger...

Related Result