--
不知道會不會衍生其他問題,有後續狀況再更新
--
1 |
# netstat -anltp |
出現大量的 TIME_WAIT 大概長這樣
1 2 3 4 5 6 7 8 9 10 11 |
tcp 0 0 127.0.0.1:51724 127.0.0.1:3306 TIME_WAIT - tcp 0 0 127.0.0.1:3306 127.0.0.1:52010 TIME_WAIT - tcp 0 0 127.0.0.1:3306 127.0.0.1:51632 TIME_WAIT - tcp 0 0 127.0.0.1:51904 127.0.0.1:3306 TIME_WAIT - tcp 0 0 127.0.0.1:51410 127.0.0.1:3306 TIME_WAIT - tcp 0 0 127.0.0.1:51836 127.0.0.1:3306 TIME_WAIT - tcp 0 0 127.0.0.1:51442 127.0.0.1:3306 TIME_WAIT - tcp 0 0 127.0.0.1:51936 127.0.0.1:3306 TIME_WAIT - tcp 0 0 127.0.0.1:3306 127.0.0.1:51638 TIME_WAIT - tcp 0 0 127.0.0.1:52066 127.0.0.1:3306 TIME_WAIT - tcp 0 0 127.0.0.1:51306 127.0.0.1:3306 TIME_WAIT - |
通常 Google 找到的資料是這樣
1 2 3 4 5 6 |
vi /etc/sysctl.conf net.ipv4.tcp_syncookies = 1 net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_tw_recycle = 1 net.ipv4.tcp_fin_timeout = 30 |
1 2 3 4 5 |
# sysctl -p # netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}' CLOSE_WAIT 2 ESTABLISHED 38 TIME_WAIT 444 |
會噴 cannot stat /proc/sys/net/ipv4/tcp_tw_recycle: No such file or directory 錯誤,而且問題沒有改善,可以得知關鍵就是 tcp_tw_recycle 這個參數,只好繼續找答案
1 2 3 |
vi /etc/sysctl.conf net.ipv4.tcp_max_tw_buckets = 100 |
1 2 3 4 5 6 |
# sysctl -p # netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}' LAST_ACK 1 CLOSE_WAIT 2 ESTABLISHED 38 TIME_WAIT 100 |
- sysctl -p 設定啟用
--
1,571 total views, 1 views today