
正文
[问题解决] 启动mongod 时,出现addr already in use错误
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
错误:
启动mongod
root@wangyuyu-Vostro-:/usr/bin# ./mongod
错误提示:
Sat Aug :: [initandlisten] ERROR: listen(): bind() failed errno: Address already in use for socket: 0.0.0.0:
Sat Aug :: [initandlisten] ERROR: addr already in use
原因:
启动mongod时端口被占用。
解决方案:
使用命令
root@wangyuyu-Vostro-:/usr/bin# netstat -anp|more
可以看到客户端还保持着与服务器的连接
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 127.0.0.1: 0.0.0.0:* LISTEN /mongod
tcp 127.0.0.1: 0.0.0.0:* LISTEN /dnsmasq
tcp 127.0.0.1: 0.0.0.0:* LISTEN /cupsd
tcp 127.0.0.1: 0.0.0.0:* LISTEN /mongod
tcp 192.168.5.124: 91.189.89.144: CLOSE_WAIT /ubuntu-geoip-p
tcp 192.168.5.124: 220.181.111.24: FIN_WAIT1 -
tcp 192.168.5.124: 219.148.35.218: ESTABLISHED /firefox
杀死953进程
root@wangyuyu-Vostro-:/usr/bin# kill -
再次察看服务器链接状态:
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 127.0.0.1: 0.0.0.0:* LISTEN /dnsmasq
tcp 127.0.0.1: 0.0.0.0:* LISTEN /cupsd
tcp 192.168.5.124: 61.172.207.130: TIME_WAIT -
tcp 192.168.5.124: 91.189.89.144: CLOSE_WAIT /ubuntu-geoip-p
tcp 192.168.5.124: 117.79.157.237: TIME_WAIT -
OK已经成功杀掉进程。
root@wangyuyu-Vostro-:/usr/bin# ./mongod Sat Aug :: [initandlisten] waiting for connections on port
Sat Aug :: [websvr] admin web console waiting for connections on port
问题解决。








