mongod 命令执行发现已经有进程在运行mongod数据库--errno:48 Address already in use for socket: 0.0.0.0:27017

错误信息:

listen(): bind() failed errno:48 Address already in use for socket: 0.0.0.0:27017

 27017端口已经被占用

完整error信息

2016-10-24T23:46:56.314+0800 E NETWORK  [initandlisten] listen(): bind() failed errno:48 Address already in use for socket: 0.0.0.0:27017

2016-10-24T23:46:56.314+0800 E NETWORK  [initandlisten]   addr already in use

2016-10-24T23:46:56.314+0800 E STORAGE  [initandlisten] Failed to set up sockets during startup.

2016-10-24T23:46:56.314+0800 I CONTROL  [initandlisten] dbexit:  rc: 48

 

处理方法:终端中输入:

ps aux | grep mongod

找到对应进程id,杀死:

kill -9 pid

如下图,

再次执行 mongod 命令就可以开启 mongodb 服务 

window 下解决方法:

http://stackoverflow.com/questions/34709062/failed-to-set-up-sockets-during-startup-dbexit-rc-48-error-in-mongodb/35650275

Find the process running on port 27017:

C:\Users\hughes> netstat -aon | findstr 27017
  TCP    0.0.0.0:27017          0.0.0.0:0              LISTENING       3344

The last column shows the PID (3344). Find the process name for that PID:

C:\Users\hughes> tasklist /fi "pid eq 3344"
Image Name                     PID Session Name        Session#    Mem Usage
========================= ======== ================ =========== ============
VirtualBox.exe                3344 Console                    1    101,908 K

For me it turned out that VirtualBox's port forwarding was the issue.

 

posted @   wjwdive  阅读(5744)  评论(0编辑  收藏  举报
编辑推荐:
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· AI 智能体引爆开源社区「GitHub 热点速览」
· Manus的开源复刻OpenManus初探
· 写一个简单的SQL生成工具
点击右上角即可分享
微信分享提示