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.

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM