$ netstat -anpl | grep '127.0.0.1:6379' (Not all processes could be identified, non-owned process info will not be shown, you would have to be root to see it all.) tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN 32249/redis-server tcp 0 0 127.0.0.1:18935 127.0.0.1:6379 TIME_WAIT - tcp 0 0 127.0.0.1:22933 127.0.0.1:6379 TIME_WAIT - tcp 0 0 127.0.0.1:21807 127.0.0.1:6379 TIME_WAIT - tcp 0 0 127.0.0.1:23023 127.0.0.1:6379 TIME_WAIT - tcp 0 0 127.0.0.1:22617 127.0.0.1:6379 TIME_WAIT - tcp 0 0 127.0.0.1:19381 127.0.0.1:6379 TIME_WAIT - tcp 0 0 127.0.0.1:19825 127.0.0.1:6379 TIME_WAIT - tcp 0 0 127.0.0.1:20345 127.0.0.1:6379 TIME_WAIT - tcp 0 0 127.0.0.1:22963 127.0.0.1:6379 TIME_WAIT - tcp 0 0 127.0.0.1:20971 127.0.0.1:6379 TIME_WAIT - tcp 0 0 127.0.0.1:22411 127.0.0.1:6379 TIME_WAIT -
TIME_WAIT的官方的解释是“FINs have been received and ACK has been sent passive TCP. active TCP is waiting 2MSLs to remove the connection from the connection table.” 也就是说redis已经发了ack了,但是nginx未必会收到,所以需要等待2MSLs时间。 我们这个系统的MSL是30秒
$ netstat -anpl | grep '120.xx.yy.zz:80' (Not all processes could be identified, non-owned process info will not be shown, you would have to be root to see it all.) tcp 0 0 120.xx.yy.zz:80 120.xx.yy.zz:57813 TIME_WAIT - tcp 0 0 120.xx.yy.zz:80 120.xx.yy.zz:60279 TIME_WAIT - tcp 0 0 120.xx.yy.zz:80 120.xx.yy.zz:58449 TIME_WAIT - tcp 0 0 120.xx.yy.zz:80 120.xx.yy.zz:58837 TIME_WAIT - tcp 0 0 120.xx.yy.zz:80 120.xx.yy.zz:59959 TIME_WAIT - tcp 0 0 120.xx.yy.zz:80 120.xx.yy.zz:57651 TIME_WAIT - tcp 0 0 120.xx.yy.zz:80 120.xx.yy.zz:59497 TIME_WAIT -