md"C:\ProgramFiles\MongoDB\log"IntheCommandPrompt,createaconfigurationfileforthelogpathoptionforMongoDB:
echologpath=C:\ProgramFiles\MongoDB\log\mongo.log>"C:\ProgramFiles\MongoDB\mongod.cfg"
RuntheMongoDBservice.
RunallofthefollowingcommandsinCommandPromptwith“AdministrativePrivileges:”InstalltheMongoDBservice.For--installtosucceed,youmustspecifythelogpathrun-timeoption.
"C:\ProgramFiles\MongoDB\bin\mongod.exe"--config"C:\ProgramFiles\MongoDB\mongod.cfg"--installModifythepathtothemongod.cfgfileasneeded.
Touseanalternatedbpath,specifythepathintheconfigurationfile(e.g.C:\ProgramFiles\MongoDB\mongod.cfg)oronthecommandlinewiththe--dbpathoption.
Ifthedbpathdirectorydoesnotexist,mongod.exewillnotstart.Thedefaultvaluefordbpathis\data\db.Ifneeded,youcaninstallservicesformultipleinstancesofmongod.exeormongos.exe.Installeachservicewithaunique--serviceNameand--serviceDisplayName.Usemultipleinstancesonlywhensufficientsystemresourcesexistandyoursystemdesignrequiresit.
StoporremovetheMongoDBserviceasneeded.
TostoptheMongoDBserviceusethefollowingcommand:netstopMongoDB
ToremovetheMongoDBserviceusethefollowingcommand:
"C:\ProgramFiles\MongoDB\bin\mongod.exe"--remove
ManuallyCreateaWindowsServiceforMongoDB
ThefollowingprocedureassumesyouhaveinstalledMongoDBusingtheMSIinstaller,withthedefaultpathC:\ProgramFiles\MongoDB2.6Standard.
Ifyouhaveinstalledinanalternativedirectory,youwillneedtoadjustthepathsasappropriate.
OpenanAdministratorcommandprompt.
Windows7/Vista/Server2008(andR2)
PressWin+R,thentypecmd,thenpressCtrl+Shift+Enter.Windows8
PressWin+X,thenpressA.ExecutetheremainingstepsfromtheAdministratorcommandprompt.
Createdirectories.
Createdirectoriesforyourdatabaseandlogfiles:mkdirc:\data\db mkdirc:\data\log
Createaconfigurationfile.
Createaconfigurationfile.Thisfilecanincludeanyoftheconfigurationoptionsformongod,butmustincludeavalidsettingforlogpath:Thefollowingcreatesaconfigurationfile,specifyingboththelogpathandthedbpathsettingsintheconfigurationfile:
echologpath=c:\data\log\mongod.log>"C:\ProgramFiles\MongoDB2.6Standard\mongod.cfg"echodbpath=c:\data\db>>"C:\ProgramFiles\MongoDB2.6Standard\mongod.cfg"
CreatetheMongoDBservice.
CreatetheMongoDBservice.sc.execreateMongoDBbinPath="\"C:\ProgramFiles\MongoDB2.6Standard\bin\mongod.exe\"--service--config=\"C:\ProgramFiles\MongoDB2.6Standard\mongod.cfg\""DisplayName="MongoDB2.6Standard"start="auto"
sc.exerequiresaspacebetween“=”andtheconfigurationvalues(eg“binPath=”),anda“”toescapedoublequotes.
Ifsuccessfullycreated,thefollowinglogmessagewilldisplay:
[SC]CreateServiceSUCCESS
5
StarttheMongoDBservice.
netstartMongoDB
6
StoporremovetheMongoDBserviceasneeded.
TostoptheMongoDBservice,usethefollowingcommand:netstopMongoDB
ToremovetheMongoDBservice,firststoptheserviceandthenrunthefollowingcommand:
sc.exedeleteMongoDB
更多:降低电脑性能Install MongoDB on Windows
https://www.002pc.com/diannaojichu/862.html
你可能感兴趣的Windows,MongoDB,Install
