1. mongod --logpath ../logs/mongodb.log --logappend --dbpath ../data/db -directoryperdb --serviceName MongoDB --install
控制台显示:all output going to: ../logs/mongodb.log
2. 查看系统服务,可以找到MongoDB,执行运行,但返回1053错误!
3. 查看../logs/mongodb.log日志,显示如下:
There is already a service named MongoDB. Aborting
Sun Feb 17 09:45:19 dbexit:
Sun Feb 17 09:45:19 shutdown: going to close listening sockets...
Sun Feb 17 09:45:19 shutdown: going to flush diaglog...
Sun Feb 17 09:45:19 shutdown: going to close sockets...
Sun Feb 17 09:45:19 shutdown: waiting for fs preallocator...
Sun Feb 17 09:45:19 shutdown: closing all files...
Sun Feb 17 09:45:19 closeAllFiles() finished
Sun Feb 17 09:45:19 dbexit: really exiting now
说明并MongoDB服务并未安装成功
4. 解决方案
打开注册表编辑器,找到HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesMongoDB
将ImagePath改为
"D:devmongodb-win32-i386-2.0.7binmongod.exe" --logpath "D:/dev/mongodb-win32-i386-2.0.7/logs/mongodb.log" --logappend --dbpath "D:/dev/mongodb-win32-i386-2.0.7/data/db" --directoryperdb --serviceName MongoDB --service
NOTE:--logpath和--dbpath必须为绝对路径
再次启动服务,服务正常工作,正常的启动日志是:
***** SERVER RESTARTED *****
Sun Feb 17 11:22:30 [initandlisten] MongoDB starting : pid=9864 port=27017 dbpath=D:/dev/mongodb-win32-i386-2.0.7/data/db 32-bit host=XUSHUO
Sun Feb 17 11:22:30 [initandlisten]
Sun Feb 17 11:22:30 [initandlisten] ** NOTE: when using MongoDB 32 bit, you are limited to about 2 gigabytes of data
Sun Feb 17 11:22:30 [initandlisten] ** see http://blog.mongodb.org/post/137788967/32-bit-limitations
Sun Feb 17 11:22:30 [initandlisten] ** with --journal, the limit is lower
Sun Feb 17 11:22:30 [initandlisten]
Sun Feb 17 11:22:30 [initandlisten] db version v2.0.7, pdfile version 4.5
Sun Feb 17 11:22:30 [initandlisten] git version: 875033920e8869d284f32119413543fa475227bf
Sun Feb 17 11:22:30 [initandlisten] build info: windows sys.getwindowsversion(major=6, minor=0, build=6002, platform=2, service_pack='Service Pack 2') BOOST_LIB_VERSION=1_42
Sun Feb 17 11:22:30 [initandlisten] options: { dbpath: "D:/dev/mongodb-win32-i386-2.0.7/data/db", directoryperdb: true, logappend: true, logpath: "D:/dev/mongodb-win32-i386-2.0.7/logs/mongodb.log", service: true, serviceName: "MongoDB" }
Sun Feb 17 11:22:30 [websvr] admin web console waiting for connections on port 28017
Sun Feb 17 11:22:30 [initandlisten] waiting for connections on port 27017
https://blog.sciencenet.cn/blog-611051-662503.html
上一篇:
了解RETE算法的两篇经典文献下一篇:
Prediction of Core Cancer Gene using MTC Framework