Mongodb Installation Guide

Mongodb may be a next generation cross platform document-oriented database system for big data solutions for various industries like.

  • Finance
  • Clinical 
  • Insurance
  • Banking

We are attempting to create mongodb installation in easy steps.

Mongodb installation on centos 6.4, 64bit architecture

Steps :

Step1: Download RPM package from mongodb repository
Step2: Configuration of mongodb instance
Step3: Mongodb useful commands
Step4: Know errors
Step5: Install packages (mongo-19gen, mongo-10gen-server

Let us see the steps in Details:

Step1: Download RPM package from mongodb repository

Configure Redhat Package Management System (YUM) repository to install mongoDB packages

In our case we are using Centos 6.4 64bit architecture.

mongo-10gen-1.6.5-mongodb_1.x86_64.rpm
mongo-10gen-server-1.6.5-mongodb_1.x86_64.rpm

Create a repository file called mongodb.repo under /etc/yum.repos.d/mongodb.repo and add following parameters require for mongoDB repository.

“If your system architecture is 64 bit use below repository settings”

# vi /etc/yum.repos.d/mongodb.repo

[mongodb]
name=MongoDB Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/
gpgcheck=0
enabled=1
Save and exit.

“If your system architecture is 32 bit use below repository settings”

#vi /etc/yum.repos.d/mongodb.repo

[mongodb]
name=MongoDB Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686/
gpgcheck=0
enabled=1

Save and Exit

#yum install mongo-10gen mongo-10gen-server

Output:

Dependencies Resolved
================================================================================
Package                 Arch        Version                 Repository    Size
================================================================================
Installing:
mongo-10gen             x86_64      2.4.8-mongodb_1         mongodb       72 M
mongo-10gen-server      x86_64      2.4.8-mongodb_1         mongodb       12 M

Transaction Summary
================================================================================
Install       2 Package(s)

Total download size: 84 M
Installed size: 214 M
Is this ok [y/N]: y

 Step 2: configuration of mongodb instance

Create a directory structure for mongodb database

#mkdir -p /data/db

Change the owner and group permission to /data folder structure

#chown -R mongod:mongod  /data/

Modify the mongodb database location as created above “dbpath=/data/db”

# vi /etc/mongod.conf

# mongo.conf
#where to log
logpath=/var/log/mongo/mongod.log
logappend=true
# fork and run in background
fork = true
#port = 27017
dbpath=/data/db

# location of pidfile
pidfilepath = /var/run/mongodb/mongod.pid
# Disables write-ahead journaling
# nojournal = true
# Enables periodic logging of CPU utilization and I/O wait
#cpu = true
# Turn on/off security.  Off is currently the default
#noauth = true
#auth = true
Save and Exit.

Start mongod service using service command

#service mongod start

Output

Starting mongod: about to fork child process, waiting until server is ready for connections.
forked process: 13377
all output going to: /var/log/mongo/mongod.log
child process started successfully, parent exiting

[  OK  ]

List of files created in the service instance started

#ll /data/db/

Output

total 81932
drwxr-xr-x 2 mongod mongod     4096 Nov 17 17:59 journal
-rw——- 1 mongod mongod 67108864 Nov 17 17:59 local.0
-rw——- 1 mongod mongod 16777216 Nov 17 17:59 local.ns
-rwxr-xr-x 1 mongod mongod        0 Nov 17 17:59 mongod.lock
drwxr-xr-x 2 mongod mongod     4096 Nov 17 17:59 _tmp

Login to mongoDB terminal console to manage it

#mongo

MongoDB shell version: 2.4.8
connecting to: test
> show databases;
admin   (empty)
local   0.078125GB

>exit;

Invoke the URL in browser sitting at client machine reachable to mongodb server.

http://IPAddress:28017/

Step3: Mongodb useful commands

Step4: Know errors

Error 1

The solution is to clear out the old repo data in order to download and use the new information. This can be accomplished a couple of ways.

First, issue the following command as root.

# yum clean all

If the above command doesn’t work, delete the files manually with:

# rm /var/cache/yum/rhel-x86_64-server-5/*

Error 2

exception in initAndListen: 10309 Unable to create/open lock file: /data/db/mongod.lock errno:13 Permission denied Is a mongod instance already running?, terminating

#chown -R  mongod:mongod /data/db

Step5: install packages (mongo-19gen, mongo-10gen-server)

#cd /opt/

“If your system architecture is 64 bit use below repository settings”

#wget http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/RPMS/mongo-10gen-1.6.5-mongodb_1.x86_64.rpm
#wget http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/RPMS/mongo-10gen-server-1.6.5-mongodb_1.x86_64.rpm
#rpm –ivh mongo-10gen-1.6.5-mongodb_1.x86_64.rpm
#rpm –ivh mongo-10gen-server-1.6.5-mongodb_1.x86_64.rpm

“If your system architecture is 32 bit use below repository settings”

#wget http://downloads-distro.mongodb.org/repo/redhat/os/i686/RPMS/mongo-10gen-1.6.5-mongodb_1.i686.rpm
#wget http://downloads-distro.mongodb.org/repo/redhat/os/i686/RPMS/mongo-10gen-server-1.6.5-mongodb_1.i686.rpm
#rpm –ivh mongo-10gen-1.6.5-mongodb_1.i686.rpm
#rpm –ivh mongo-10gen-server-1.6.5-mongodb_1.i686.rpm

 

Both comments and pings are currently closed.

Comments are closed.

Copyright ©Solutions@Experts.com
Copyright © NewWpThemes Techmark Solutions - www.techmarksolutions.co.uk