Saturday, August 1, 2015

MongoDB Configuration in Linux

MongoDB Configuration in Linux

1. Create a folder named 'test' (Anything you want)     

$ mkdir -p /test/mongodb  /app/dbMongo     
# /test/mongodb  = Holds the MongoDB source      
# /app/dbMongo = Holds the MongoDB database

2. Extract the Mongo DB zip file in /test folder  
$ tar -xvf MongoDB.tar  /test/mongodb

3.  change the permission of folder-  For me the User is - mannu and Group - mannu
  $ chown -R mannu:mannu  /test/mongodb  /app/dbMongo

4. Create a configuration file for MongoDB and edit as per your installation 
 
5. Add these line in .bashrc file

---------------------------------------------------------------------------------

# User specific aliases and functions
#Home location for MongoDB

MONGO_HOME='/test/mongodb'

#Mongo DB start command alias
alias SdbMongo='$MONGO_HOME/bin/mongod --config /app/dbMongo.conf' 

#Add MongoDB in PATH
export PATH=$PATH:$MONGO_HOME/bin

6. for Starting MongoDB, simply execute the alias which we have created.
$ SdbMongo
# or execute the below command
$ $MONGO_HOME/bin/mongod --config /app/dbMongo.conf

---------------------------------------------------------------------------------

mongod.pid file holds the process id for mongoDB

mongod.log file hold the log of mongoDB

No comments:

Post a Comment