这是我在终端
中发出mongod
时出错的错误
2017-06-25T14:53:50.591+0530 I CONTROL [initandlisten] MongoDB
starting : pid=7402 port=27017 dbpath=/data/db 64-bit
host=bhagyashree-MS-7994
2017-06-25T14:53:50.591+0530 I CONTROL [initandlisten] db version
v3.2.14
2017-06-25T14:53:50.591+0530 I CONTROL [initandlisten] git version:
92f6668a768ebf294bd4f494c50f48459198e6a3
2017-06-25T14:53:50.591+0530 I CONTROL [initandlisten] OpenSSL
version: OpenSSL 1.0.2g 1 Mar 2016
2017-06-25T14:53:50.591+0530 I CONTROL [initandlisten] allocator:
tcmalloc
2017-06-25T14:53:50.591+0530 I CONTROL [initandlisten] modules: none
2017-06-25T14:53:50.591+0530 I CONTROL [initandlisten] build
environment:
2017-06-25T14:53:50.591+0530 I CONTROL [initandlisten] distmod:
ubuntu1604
2017-06-25T14:53:50.591+0530 I CONTROL [initandlisten] distarch:
x86_64
2017-06-25T14:53:50.591+0530 I CONTROL [initandlisten]
target_arch: x86_64
2017-06-25T14:53:50.591+0530 I CONTROL [initandlisten] options: {}
2017-06-25T14:53:50.609+0530 E NETWORK [initandlisten] listen():
bind() failed errno:98 Address already in use for socket:
0.0.0.0:27017
2017-06-25T14:53:50.609+0530 E NETWORK [initandlisten] addr already
in use
2017-06-25T14:53:50.609+0530 E STORAGE [initandlisten] Failed to set
up sockets during startup.
2017-06-25T14:53:50.609+0530 I CONTROL [initandlisten] dbexit: rc:
48
在发出sudo netstat -plnt
时,我得到以下输出,
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address
State PID/Program name
tcp 0 0 127.0.1.1:53 0.0.0.0:*
LISTEN 1920/dnsmasq
tcp 0 0 127.0.0.1:6942 0.0.0.0:*
LISTEN 3725/java
tcp 0 0 127.0.0.1:27017 0.0.0.0:*
LISTEN 7272/mongod
tcp 0 0 127.0.0.1:63342 0.0.0.0:*
LISTEN
3725/java
提前谢谢!!我感谢所有的帮助!!
答案 0 :(得分:1)
错误清楚地说明了问题。您正在尝试启动已在运行的进程或将其分配给已占用的端口。解决这个问题的方法很少。
<强> 1。停止服务并重新启动
sudo service mongod stop
sudo mongod
<强> 2。快速修复(根据他们的文档可能不是最好的)
killall mongod
第3。处理流程 完成哪个进程正在运行mongodb端口
sudo netstat -tulpn | grep :27017
接下来,通过命令
终止正在使用它的进程sudo kill PID
(PID - 进程ID)
现在,您可以重新开始。它应该启动并运行!