伊谢尔伦2017-04-17 17:10:57
Use the command to view
[root@web ~]# netstat -anp | grep 80
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1652/nginx: master
tcp 0 0 127.0.0.1:8080 0.0.0.0:* LISTEN 1377/httpd
tcp 0 0 10.1.1.14:9300 10.1.1.18:59080 ESTABLISHED 1305/java
tcp 0 0 127.0.0.1:49800 127.0.0.1:3306 ESTABLISHED 1715/zabbix_server:
tcp 0 0 10.1.1.14:50480 10.1.1.17:10050 TIME_WAIT -
tcp 0 0 127.0.0.1:3306 127.0.0.1:49806 ESTABLISHED 1410/mysqld
tcp 0 0 127.0.0.1:50280 127.0.0.1:3306 ESTABLISHED 1699/zabbix_server:
tcp 0 0 127.0.0.1:3306 127.0.0.1:49800 ESTABLISHED 1410/mysqld
tcp 0 0 127.0.0.1:3306 127.0.0.1:49804 ESTABLISHED 1410/mysqld
tcp 0 0 10.1.1.14:33880 10.1.2.16:10050 TIME_WAIT -
tcp 0 0 127.0.0.1:49806 127.0.0.1:3306 ESTABLISHED 1711/zabbix_server:
tcp 0 0 127.0.0.1:49808 127.0.0.1:3306 ESTABLISHED 1724/zabbix_server:
tcp 0 0 10.1.1.14:36802 10.1.1.18:10050 TIME_WAIT -
tcp 0 0 127.0.0.1:49804 127.0.0.1:3306 ESTABLISHED 1708/zabbix_server:
tcp 0 0 127.0.0.1:49802 127.0.0.1:3306 ESTABLISHED 1706/zabbix_server:
tcp 0 0 10.1.1.14:54880 10.1.1.16:10050 TIME_WAIT -
tcp 0 0 10.1.1.14:54808 10.1.1.16:10050 TIME_WAIT -
tcp 0 0 127.0.0.1:3306 127.0.0.1:49808 ESTABLISHED 1410/mysqld
tcp 0 0 127.0.0.1:3306 127.0.0.1:49802 ESTABLISHED 1410/mysqld
tcp 0 0 127.0.0.1:3306 127.0.0.1:50280 ESTABLISHED 1410/mysqld
raw 0 768 0.0.0.0:1 0.0.0.0:* 7 23580/fping
For example: 1652/nginx: master, where "1652" is the PID and "nginx: master" is the program name.
Use the following command to kill:
[root@web ~]# kill -9 1652
If you know what program this is, it is recommended to use the program's own command to stop the service instead of rudely ending it with kill.
PHP中文网2017-04-17 17:10:57
The port is open because you have started the related service, you just need to turn off the service
Find the service and kill it or shut down
巴扎黑2017-04-17 17:10:57
This is because the system needs a certain amount of time to release the port. For example, when writing the flask service, if it is not set to DEBUG mode, CTRL+C will often be required. This will cause the 5000 port to not be released immediately. When the service is started again, it will report that the port is occupied. . If you write the socket service yourself, you can add a line of code to enable the system to release the port immediately after the service stops.
socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
大家讲道理2017-04-17 17:10:57
http://blog.csdn.net/cuiyong_... You can check this blog, it’s more detailed