How do I start MongoDB

If MongoDB installed successfully through RPM installation/any other process, you’ll usually see the below Mongo binaries in the bin (eg. */opt/mongodb/bin*) folder which will be useful to start the Mongo processes (mongod&mongos).

[user@hostname bin]$ pwd
/opt/mongodb/bin
[user@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
[user@hostname bin]$

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

There are MongoDB Front-end tools like below in the market.
MongoVUE | Gui tools for MongoDB

However, to connect MongoDB we’ll use above mongo binary file as below.

[user@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
newdb1 (empty)
config 0.046875GB
mongo 0.203125GB
newdb 0.203125GB
newddb (empty)
mongos>

Feel free to contact us for any further queries/issues.

  • Ask Question