MongoDB-使用代码48关闭 [英] MongoDB - shutting down with code 48
问题描述
我正在尝试启动MongoDB,但是终端返回以下错误:
I am trying to start MongoDB but the terminal returns the following error:
2017-02-06T16:26:27.037+0000 I CONTROL [initandlisten] MongoDB starting : pid=25184 port=27017 dbpath=/data/db 64-bit host=Janiss-MacBook-Pro.local
2017-02-06T16:26:27.037+0000 I CONTROL [initandlisten] db version v3.4.1
2017-02-06T16:26:27.037+0000 I CONTROL [initandlisten] git version: 5e103c4f5583e2566a45d740225dc250baacfbd7
2017-02-06T16:26:27.037+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2k 26 Jan 2017
2017-02-06T16:26:27.037+0000 I CONTROL [initandlisten] allocator: system
2017-02-06T16:26:27.037+0000 I CONTROL [initandlisten] modules: none
2017-02-06T16:26:27.037+0000 I CONTROL [initandlisten] build environment:
2017-02-06T16:26:27.037+0000 I CONTROL [initandlisten] distarch: x86_64
2017-02-06T16:26:27.037+0000 I CONTROL [initandlisten] target_arch: x86_64
2017-02-06T16:26:27.037+0000 I CONTROL [initandlisten] options: {}
2017-02-06T16:26:27.038+0000 E NETWORK [initandlisten] listen(): bind() failed Address already in use for socket: 0.0.0.0:27017
2017-02-06T16:26:27.038+0000 E NETWORK [initandlisten] addr already in use
2017-02-06T16:26:27.038+0000 E NETWORK [initandlisten] Failed to set up sockets during startup.
2017-02-06T16:26:27.038+0000 E STORAGE [initandlisten] Failed to set up listener: InternalError: Failed to set up sockets
2017-02-06T16:26:27.038+0000 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2017-02-06T16:26:27.038+0000 I NETWORK [initandlisten] shutdown: going to flush diaglog...
2017-02-06T16:26:27.039+0000 I CONTROL [initandlisten] now exiting
2017-02-06T16:26:27.039+0000 I CONTROL [initandlisten] shutting down with code:48
如果要紧的话,我正在使用Laravel Valet.
I am using Laravel Valet if that matters.
推荐答案
似乎您已经在要启动mongodb的端口上运行了一个进程:
It seems like you have already a process running on the port where you want to start mongodb:
listen(): bind() failed Address already in use for socket: 0.0.0.0:27017
2017-02-06T16:26:27.038+0000 E NETWORK [initandlisten] addr already in use
您可以尝试使用以下命令杀死在该端口上运行的进程:
须藤杀死sudo lsof -t -i:27017
you could try to kill the process that runs on that port with this command:
sudo kill sudo lsof -t -i:27017
或为mongodb定义另一个端口(如果您有另一个使用该端口的程序).
从终端启动mongodb时,使用--port 27018
参数在默认端口(27017)以外的其他端口上运行mongodb
or define another port for mongodb if you have another program using that port.
to run mongodb on a port other than its default port (27017) use the --port 27018
argument when starting mongodb from the terminal
这篇关于MongoDB-使用代码48关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!