Linux netstat Summary

First, to see whether there is a connection between the application server and back-end services

netstat -anp|grep IP

Second, view the process corresponding port number

netstat -lntp | grep thread ID

Three, netstat analysis of the number of connections

A. the number of connection statistics

netstat -anp | grep 6379 | grep ESTABLISHED | grep -v tcp6 | awk '{print $ 5}' | awk -F: '{print $ 1}' | sort | uniq -c

B. Statistical number of servers connected to the connecting IP address

netstat -an | grep Estab | awk '{print $ 5}' | awk -F: '{print $ 1}' | sort | uniq -c | sort -No
netstat -an | grep ESTABLISHED | grep -v tcp6 | awk '{print $ 7}' | awk -F: '{print $ 1}' | sort | uniq -c
netstat -anp|awk '{print $5}'|awk -F: '{print $1}' |sort |uniq -c

netstat output:

========================================================================================
Proto  Recv-Q  Send-Q    Local Address    Foreign Address  State      PID/Programe name
 tcp      0      0       0.0.0.0:3181     0.0.0.0:*        LISTEN      13631/java
==========================================================================================

Proto: Protocol type

Recv-Q: the network receiving queue

Send-Q: sending queue, Q is an abbreviation Queue.

  Under normal circumstances, these two values ​​should be 0. If not 0 may be problematic .packets should not have two piled state in the queue. Acceptable transient is nonzero. Short Send-Q non-zero queue transmitting packets to a normal state

 

Guess you like

Origin www.cnblogs.com/moonandstar08/p/10927757.html