错误运行mongod

时间:2016-07-08 18:36:00

标签: node.js mongodb express mongoose

当运行命令" mongod"在终端。无法访问localhost:28017

我的日志

2016-07-08T11:31:15.479-0300 I CONTROL  [initandlisten] MongoDB starting : pid=12891 port=27017 dbpath=/data/db 64-bit host=lucaspc
2016-07-08T11:31:15.479-0300 I CONTROL  [initandlisten] db version v3.2.7
2016-07-08T11:31:15.479-0300 I CONTROL  [initandlisten] git version: 4249c1d2b5999ebbf1fdf3bc0e0e3b3ff5c0aaf2
2016-07-08T11:31:15.479-0300 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.1f 6 Jan 2014
2016-07-08T11:31:15.479-0300 I CONTROL  [initandlisten] allocator: tcmalloc
2016-07-08T11:31:15.479-0300 I CONTROL  [initandlisten] modules: none
2016-07-08T11:31:15.479-0300 I CONTROL  [initandlisten] build environment:
2016-07-08T11:31:15.480-0300 I CONTROL  [initandlisten]     distmod: ubuntu1404
2016-07-08T11:31:15.480-0300 I CONTROL  [initandlisten]     distarch: x86_64
2016-07-08T11:31:15.480-0300 I CONTROL  [initandlisten]     target_arch: x86_64
2016-07-08T11:31:15.480-0300 I CONTROL  [initandlisten] options: {}
2016-07-08T11:31:15.531-0300 E NETWORK  [initandlisten] listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:27017
2016-07-08T11:31:15.531-0300 E NETWORK  [initandlisten]   addr already in use
2016-07-08T11:31:15.531-0300 E STORAGE  [initandlisten] Failed to set up sockets during startup.
2016-07-08T11:31:15.531-0300 I CONTROL  [initandlisten] dbexit:  rc: 48

2 个答案:

答案 0 :(得分:0)

Address already in use for socket: 0.0.0.0:27017

您已在端口27017上运行实例,更改端口或终止现有进程。

答案 1 :(得分:0)

已经有一个使用您想要使用的接口和端口的进程。您可以找出正在使用的进程

sudo netstat -lpn | grep 27017

然后使用

sudo kill <pid>

停止它