我刚刚在Ubuntu16.04上安装了MongoDb,我不能运行服务器。当服务器的"status“(sudo systemctl启动mongodb)时,我得到了以下信息:
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'.日志(/var/ log /mongodb/mongod.log)显示了以下内容:
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我的配置文件(/etc/systemd/system/mongodb.service)包含:
[Unit]
Description=High-performance, schema-free document-oriented database
After=network.target
[Service]
User=mongodb
ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf
[Install]
WantedBy=multi-user.target发布于 2017-05-10 01:25:32
查看日志,您有另一个服务正在端口27017上运行。
查找该服务并停止它,然后重试。或者,如果您不关心在该端口上运行的服务,可以这样做
sudo fuser -k 27017/tcp另一种选择是更改mongodb的默认设置。请参阅mongodb how to change default port
https://stackoverflow.com/questions/43876003
复制相似问题