我在Windows上使用MongoDB 2.6.1.我已将其安装为服务.我能够启动该服务,并且该进程成功侦听27017,并且我能够连接到它,插入数据并运行查询.
问题是我无法连接到Web界面:
http://localhost:28017
当我回收服务时,我发现它无法绑定到28017端口,因为它看起来像是在使用中:
[websvr] ERROR: listen(): bind() failed errno:10048 Only one usage of each socket address (protocol/network address/port) is normally permitted. for socket: 0.0.0.0:28017
但是,当我运行netstat -anbo它时,不报告任何使用28017.
更新:从日志中添加更多输出以显示已启用REST,但该端口已在使用中.
2014-06-05T16:00:31.840-0700 [initandlisten] options: { config: "D:\MongoDb\bin\mongod.cfg", net: { http: { RESTInterfaceEnabled: true, enabled: true } }, service: true, storage: { dbPath: "e:\mongodb\data" }, systemLog: { destination: "file", path: "e:\mongodb\logs\mongo.log" } }
2014-06-05T16:00:31.860-0700 [initandlisten] journal dir=e:\mongodb\data\journal
2014-06-05T16:00:31.861-0700 [initandlisten] recover : no journal files present, no recovery needed
2014-06-05T16:00:31.902-0700 [initandlisten] waiting for connections on port 27017
2014-06-05T16:00:31.902-0700 [websvr] ERROR: listen(): bind() failed errno:10048 Only one usage of each socket address (protocol/network address/port) is normally permitted. for socket: 0.0.0.0:28017
Run Code Online (Sandbox Code Playgroud)
您需要为mongod启用Web界面 - 默认情况下不启动.如果以这种方式启动mongodb:
mongod --rest
Run Code Online (Sandbox Code Playgroud)
您应该能够在28017连接到Web界面