Details about port usage in linux, and details about linux
The port is often occupied when a program is started. Here we will explain how to check whether the port is occupied, and which program is occupied, and how to Kill the program with the occupied port.
1. lsof-I: port
Port is the port number.
[Root @ slave/data/spark-1.4.0-bin-cdh4] # lsof-I: 8080
Command pid user fd type device size/OFF NODE NAME
Impalad 11978 mqq 150u IPv4 549847837 0t0 TCP *: webcache (LISTEN)
The above command shows that port 8080 is occupied by impalad, and the process ID is 11978.
To kill the process, run the following command:
Kill-9 11978 kill the program
2. Run the netstat and ps commands to check the port-consuming program and process ID.
[Root @ slave/data/spark-1.4.0-bin-cdh4] # netstat-apn | grep 8080
Tcp 0 0 0.0.0.0: 8080 0.0.0.0: * LISTEN 11978/impalad
Tcp 0 0 192.168.209.16: 53501 192.168.209.19: 8080 TIME_WAIT-
We can see that 8080 is occupied by impalad and the process ID is 11978. Then we can see the path of the program through the following command.
[Root @ slave/data/spark-1.4.0-bin-cdh4] # ps-elf | grep impalad
0 S of mqq 11978 1 9 80 0-15906542 futex _ Jun25? 2-01:23:55/usr/lib/impala/sbin/impalad-log_dir =/data/log/impala-catalog_service_host = host. impala-state_store_port = 24000-use_statestore-webserver_port = 8080-state_store_host = host. impala-be_port = 22000-default_query_options = DEFAULT_ORDER_BY_LIMIT = 1000000
0 S root 27963 24729 0 80 0-25810 pipe_w 00:00:00 pts/5 grep impalad
Java enterprise-level general permission security framework source code SpringMVC mybatis or hibernate + ehcache shiro druid bootstrap HTML5
[Download java framework source code]