MongoDB Installation

Please get the required binaries from the below link and copy to your server.

http://docs.mongodb.org/manual/administration/install-on-linux/
If MongoDB installed successfully, you'll usually see the below Mongo binaries in the dbpath usually */opt/mongodb/bin* folder which will be useful to start the Mongo processes (mongod&mongos).
 
[root@hostname bin]$ pwd
/opt/mongodb/bin
[root@hostname bin]$ ls -lthr mongo*
-rwxr-xr-x 1 mongod mongod 8.6M Jul 12 2013 mongo
-rwxr-xr-x 1 mongod mongod 16M Jul 12 2013 mongod
-rwxr-xr-x 1 mongod mongod 16M Jul 12 2013 mongodump
-rwxr-xr-x 1 mongod mongod 16M Jul 12 2013 mongoexport
-rwxr-xr-x 1 mongod mongod 16M Jul 12 2013 mongofiles
-rwxr-xr-x 1 mongod mongod 16M Jul 12 2013 mongoimport
-rwxr-xr-x 1 mongod mongod 16M Jul 12 2013 mongooplog
-rwxr-xr-x 1 mongod mongod 16M Jul 12 2013 mongoperf
-rwxr-xr-x 1 mongod mongod 16M Jul 12 2013 mongorestore
-rwxr-xr-x 1 mongod mongod 12M Jul 12 2013 mongos
-rwxr-xr-x 1 mongod mongod 16M Jul 12 2013 mongostat
-rwxr-xr-x 1 mongod mongod 16M Jul 12 2013 mongotop
[root@hostname bin]$
 
You can refer to below scripts/commands for the the setting-up MongoDB as per your requirement.
 
http://dbversity.com/mongodb-shard-creation-script/
http://dbversity.com/how-do-i-stop-replication-within-replica-set-in-mongodb/
On a brief, to start mongod process
./mongod --dbpath /opt/mongodb/data/ --logpath /opt/mongodb/logs/mongod.log --port 27020
And to start mongos process
/mongos --configdb xx.xx.xx.xx:39000,xx.xx.xx.xx:39001,xx.xx.xx.xx:39002 --logpath /opt/mongodb/logs/router.log --port 10000
Please refer the attached script for the complete process.
 
There are MongoDB Front-end tools like below in the market.
http://www.mongovue.com/
However, to connect MongoDB we'll use above mongo binary file as below.
 
[root@hostname bin]$ ./mongo hostname:10000/admin -u admin -p
MongoDB shell version: 2.4.5
Enter password:
connecting to: hostname:10000/admin
mongos>
mongos>
mongos>
mongos> show dbs
admin 0.046875GB
mydb (empty)
config 0.046875GB
mongo 0.203125GB
newdb 0.203125GB
newddb (empty)
mongos>
Refer the link for creating initial users http://dbversity.com/mongodb-authentication/
 
Feel free to contact me for any further queries/issues.

  • Ask Question