我无法启动mongodb服务器

时间:2017-05-09 17:11:28

标签: node.js mongodb

我刚刚在Ubuntu 16.04上安装了MongoDb,我无法运行服务器。当"状态"时,我得到以下信息。服务器(sudo systemctl start mongodb):

setlocal /?

日志(/var/log/mongodb/mongod.log)显示以下内容:

lmunoz@lmunoz:/var/www/node/dashboard$ sudo systemctl status mongodb
● mongodb.service - High-performance, schema-free document-oriented 
database
Loaded: loaded (/etc/systemd/system/mongodb.service; enabled; vendor 
preset: enabled)
Active: failed (Result: exit-code) since mar 2017-05-09 12:01:59 PET; 
29s ago
Process: 1042 ExecStart=/usr/bin/mongod --quiet --config 
/etc/mongod.conf (code=exited, status=48)
Main PID: 1042 (code=exited, status=48)

may 09 12:01:59 lmunoz systemd[1]: Started High-performance, schema-
free document-oriented database.
may 09 12:01:59 lmunoz systemd[1]: mongodb.service: Main process 
exited, code=exited, status=48/n/a
may 09 12:01:59 lmunoz systemd[1]: mongodb.service: Unit entered 
failed state.
may 09 12:01:59 lmunoz systemd[1]: mongodb.service: Failed with result 
'exit-code'.

我的配置文件(/etc/systemd/system/mongodb.service)包含:

listen(): bind() failed errno:98 Address already in use for socket: 
127.0.0.1:27017
addr already in use
Failed to set up sockets during startup.
dbexit:  rc: 48

1 个答案:

答案 0 :(得分:2)

查看您正在端口27017上运行的另一项服务的日志。

查找该服务并将其停止然后重试。或者,如果您不关心在该端口上运行的服务,可以执行

{{1}}

另一种方法是更改​​mongodb的默认值。见mongodb how to change default port