介绍
这篇文章主要介绍解决mongodb端口占用的方法,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!
启动mongod:
root@wangyuyu -成就- 1440:/usr/bin #,。/mongod
错误提示:
Sat Aug 17, 09:02:02 [initandlisten],错误:,():听,绑定(),failed errno: 98年,Address already 拷贝use for 插座:, 0.0.0.0:27017 Sat Aug 17, 09:02:02 [initandlisten],错误:,addr already 拷贝使用
原因是启动mongod时端口被占用。
解决办法:
使用命令:root@wangyuyu -成就- 1440:/usr/bin # netstat anp |更多
可以看到客户端还保持着与服务器的连接。
Proto Recv-Q Send-Q ,,,,,, Local Address ,,,,,,,, Foreign Address ,,,,,,,,, State ,,,,,, PID/Program 名字 tcp ,,,,,,, 0,,,,,, 0, 127.0.0.1:28017 ,,,,,,,, 0.0.0.0: *,,,,,,,,,,,, LISTEN ,,,,, 953/mongod ,,,,, tcp ,,,,,,, 0,,,,,, 0, 127.0.0.1:53 ,,,,,,,,,, 0.0.0.0: *,,,,,,,,,,,, LISTEN ,,,,, 1546/dnsmasq ,,, tcp ,,,,,,, 0,,,,,, 0, 127.0.0.1:631 ,,,,,,,,,, 0.0.0.0: *,,,,,,,,,,,,, LISTEN ,,,,, 653/cupsd ,,,,,, tcp ,,,,,,, 0,,,,,, 0, 127.0.0.1:27017 ,,,,,,,, 0.0.0.0: *,,,,,,,,,,,, LISTEN ,,,,, 953/mongod ,,,,, tcp ,,,,,,, 1,,,,,, 0, 192.168.5.124:56874 ,,,, 91.189.89.144:80 ,,,,,,, CLOSE_WAIT , 1913/ubuntu-geoip-p tcp ,,,,,,, 0,,,,,, 1, 192.168.5.124:45890 ,,,, 220.181.111.24:80 ,,,,,, FIN_WAIT1 ,, 女人,,,,,,,,,,,,,,, tcp ,,,,,,, 0,,,,,, 0, 192.168.5.124:44867 ,,,, 219.148.35.218:80 ,,,,,, 2219/firefox
杀死953进程:root@wangyuyu -成就- 1440:/usr/bin # kill - 9 953
再次查看服务器连接状态:
Proto Recv-Q Send-Q ,,,,, Local Address ,,,,,,, Foreign Address ,,,,,,,,,,,,, State ,,,,,, PID/Program 名字 tcp ,,,,,,, 0,,,,,, 0, 127.0.0.1:53 ,,,,,,,,, 0.0.0.0: *,,,,,,,,,,,,,,,, LISTEN ,,,,, 1546/dnsmasq ,,, tcp ,,,,,,, 0,,,,,, 0, 127.0.0.1:631 ,,,,,,,, 0.0.0.0: *,,,,,,,,,,,,,,, LISTEN ,,,,, 653/cupsd ,,,,,, tcp ,,,,,,, 0,,,,,, 0, 192.168.5.124:60805 ,,,, 61.172.207.130:80 ,,,,,, TIME_WAIT ,, 女人,,,,,,,,,,,,,,, tcp ,,,,,,, 1,,,,,, 0, 192.168.5.124:56874 ,,,, 91.189.89.144:80 ,,,,,,, CLOSE_WAIT , 1913/ubuntu-geoip-p null null null null解决mongodb端口占用的方法