Wednesday, March 23, 2016

MongoDB Standalone Installation

MongoDB Standalone Installation best practice and reference guide.

Install MongoDB Community Edition on Red Hat Enterprise 6.6 using .rpm package

MongoDB provides officially supports packages in their own repository.

Ø  mongodb-org             A metapackage that will automatically install the four component packages listed below.
Ø  mongodb-org-server Contains the mongod daemon and associated configuration and init scripts.
Ø  mongodb-org-mongos   Contains the mongos daemon.
Ø  mongodb-org-shell    Contains the mongo shell.
Ø  mongodb-org-tools   Contains the following MongoDB tools: mongoimport bsondump, mongodump, mongoexport, mongofiles, mongooplog, mongoperf, mongorestore, mongostat, and mongotop.


The default /etc/mongod.conf configuration file supplied by the packages has bind_ip set to 127.0.0.1 by default. Modify this setting as needed for your environment before initializing a replica set.
The mongodb-org package includes various init scripts, including the init script /etc/rc.d/init.d/mongod. You can use these scripts to stop, start, and restart daemon processes.
            Ex: sudo service mongod start/stop/restart


Installing MongoDB
1.      Configure yum (package management system), here I’m using 2mongodb-org-2.6
Create a repo file /etc/yum.repos.d/mongodb-org-2.6.repo
And below details in the repo file
[mongodb-org-3.2]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.2/x86_64/
gpgcheck=0
enabled=1
2.      Install MongoDB by issuing repo install cmd
Sudo yum install –y mongodb-org

*Recommended to install complete package, if you want install each package individually then specify each component individually and append the version number to the package name.
*You can configure SELinux to allow MongoDB to start on Red Hat Linux-based systems, by updated SELINUX variable in /etc/selinux/config but not recommended.


Default Data Directories in MongoDB
Ø  Data Files are stored in /var/lib/mongo
Ø  Log files are stored in /var/log/mongodb
If you change the user that runs the MongoDB process, you must modify the access control rights to the /var/lib/mongo and /var/log/mongodb directories to give this user access to these directories.


Simple Start Stop and Restart CMDs
$service mongod start                    Check log to see service started and default port is in listening mode
$sudo service mongod stop                Check log to see if service is shut down and port released.
You can follow the state of the process for errors or important messages by watching the output in the /var/log/mongodb/mongod.log file







No comments:

Post a Comment