windows下 mongodb 3.2加fork选项启动报unrecognised option 'fork'

本文介绍了在Windows环境下启动MongoDB遇到的问题及解决方案。当尝试使用--fork选项启动MongoDB作为后台进程时会遇到错误提示。文章提供了通过安装MongoDB服务来解决此问题的方法,并给出了具体的安装和服务启动命令。

windows下启动mongodb为后台进程加fork选项报错如下:

D:\Program Files\MongoDB\Server\3.2\bin>mongod --config "D:\Program Files\MongoD

B\Server\mongodb.conf"
Error parsing INI config file: unrecognised option 'fork'
try 'mongod --help' for more information

原因:

--fork不支持windows 解决可以通过添加mongodb为windows服务来解决

如下:

The command --fork only works for Linux/Unix. If you need --fork for running mongod in background, on Windows that can be achieved by installing mongod as a service.
When use mongod --install option to install mongodb service, the --dbpath and --logpath are required. In my case, I need use administrator command console to install the service.
For example:
mongod --dbpath=C:\mongodb\data --logpath=C:\mongodb\data\log\service.log --install
Then browse the log file to see service name and other information including any possible errors.
2014-06-25T18:21:14.245-0700 Trying to install Windows service 'MongoDB'
2014-06-25T18:21:14.253-0700 Service 'MongoDB' (MongoDB) installed with command line 'C:\mongodb-win32-x86_64-2008plus-2.6.1\bin\mongod.exe --dbpath=C:\mongodb\data --logpath=C:\mongodb\data\log\service.log --service'
2014-06-25T18:21:14.254-0700 Service can be started from the command line with 'net start MongoDB'
The default service name is "MongoDB". You can name the service name with --serviceName option when install the service.
Then start the service with net use.
net use MongoDB
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值