问题描述
目前只安装了两个版本3.0.123.2.9发现两个都无法使用--fork参数报错信息:Error parsing INI config file: unrecognised option ’fork’try ’mongod --help’ for more information于是mongod --help之后,列出的一大窜里根本就没有--fork。是不是现在的版本不支持--fork参数了
问题解答
回答1:刚刚找了一个2.4.5版本的,一样无法使用--fork参数。
The command --fork only works for Linux/Unix. If you need --fork forrunning mongod in background, on Windows that can be achieved byinstalling mongod as a service. When use mongod --install option toinstall mongodb service, the --dbpath and --logpath are required. Inmy case, I need use administrator command console to install theservice.
似乎windows不支持--fork参数,解决方案是使用--install安装windows服务。
mongodb.conf文件
cmd下启动服务器
mongodb.log文件
因为直接cmd启动没有足够权限,需要管理员权限打开cmd.exe。
cmd管理员权限启动服务器
mongodb.log文件
接着直接输入net start MongoDB启动服务器之后,就可以关闭窗口(已后台运行)了。