MongoDB Install - OmIndia

Teach To India

Thursday, August 10, 2017

MongoDB Install

START THE SERVICE AUTOMATICALLY ON SYSTEM REBOOT / RESTART

MongoDB Install

Windows

(1) Install MongoDB

(2) Add bin to path

(3) Create c:\data\db

(4) Create c:\data\log

(5) Create c:\data\mongod.cfg with contents ..

systemLog:
    destination: file
    path: c:\data\log\mongod.log
storage:
    dbPath: c:\data\db
(6) To create service that will auto start on reboot .. RUN AS ADMIN ..

sc.exe create MongoDB binPath= "\"C:\MongoDbNew\Server\bin\mongod.exe\" --service --config=\"C:\MongoDbNew\Server\mongod.cfg\"" DisplayName= "MongoDB" start= "auto"


(7) Start the service .. RUN AS ADMIN ..

net start MongoDB
IMPORTANT: Even if this says 'The MongoDB service was started successfully' it can fail

To double check open Control Panel > Services, ensure the status of the MongoDB service is 'Running'

If not, check your log file at C:\data\log\mongod.log for the reason for failure and fix it

(Do not start MongoDB via Control Panel > Services, use .. net start MongoDB)

(8) Finally, restart your machine with MongoDB running and it will still be running on restart

If you ever want to kill it ..

net stop MongoDB

sc.exe delete MongoDB


mongo c# index
mongo c# insert
mongo c# insertoneasync
mongo c# join
mongo c# library
mongo c# limit
mongo c# linq
mongo c# map reduce
mongo c# objectid
mongo c# order by
mongo c# orm
mongo c# projection
mongo c# pull
mongo c# push
mongo c# query
mongo c# query builder
mongo c# query example
mongo c# query projection
mongo c# regex
mongo c# remove
mongo c# runcommand

No comments:

Post a Comment

Comments

Popular