启动 Mongodb 时我收到此错误是套接字连接:
7 12:03:31.230 [initandlisten] ERROR: listen(): bind() failed errno:98 Address already in use for socket: 127.0.0.1:27017
Tue Apr 7 12:03:31.230 [initandlisten] ERROR: addr already in use
Tue Apr 7 12:03:31.252 [websvr] ERROR: listen(): bind() failed errno:98 Address already in use for socket: 127.0.0.1:28017
Tue Apr 7 12:03:31.253 [websvr] ERROR: addr already in use
答案1
我今天遇到了同样的问题,sudo service mongod restart
或者sudo service mongod stop
没有真正停止mongod
进程。我按照以下步骤解决了这个问题:
查找
mongod
进程 ID(414)$ sudo netstat -tlnp | grep 27017 tcp 0 0 127.0.0.1:27017 0.0.0.0:* LISTEN 414/mongod
杀
mongod
sudo kill -9 414
开始
mongod
sudo service mongod start
答案2
这可能意味着另一个 mongodb 实例已在运行。您可以使用以下命令重新启动它:
sudo 服务 mongo 重启