MongoDB新建服务(Windows)

2017-12-27  本文已影响0人  ChanZeeBm
  systemLog:
    destination: file
    path: F:\data\log\mongod.log
storage:
    dbPath: F:\data\db
  1. "F:\data\log\mongod.log" 是你想mongodb生成的配置文件数据的目录。
  2. "F:\data\db"是数据库的目录
 {MongoDB安装目录下的bin文件夹}\mongod.exe --config "{配置文件的路径}" --install
2017-12-27T08:36:02.266-0700 I CONTROL  [main] Trying to install Windows service 'MongoDB'
2017-12-27T08:36:02.267-0700 I CONTROL  [main] Service 'MongoDB' (MongoDB) installed with command line '"C:\Program Files\MongoDB\Server\3.6\bin\mongod.exe" --config F:\data\log\mongod.txt --service'
2017-12-27T08:36:02.267-0700 I CONTROL  [main] Service can be started from the command line with 'net start MongoDB'
  1. net start MongDB 成功信息:


    image.png
  2. sc start MongoDB 成功信息:


    image.png

如果启动失败,请注意查看MongoDB服务的启动路径是不是你的配置文件路径(非自动生成那个,手动新建那个)

image.png
上一篇 下一篇

猜你喜欢

热点阅读