I use the logstash TCP plugin, this is a server ; In the process of use, The client abnormal disconnected the connection, However the server didn't disconnect, So server TCP connections have been increased;
I try to modify the OS tcp_keepalive parameters, it is invalid;
tcp config:
input { tcp { host => "0.0.0.0" port => 4561 mode => "server" codec => json_lines } } output { stdout{codec =>rubydebug} elasticsearch { hosts => ["host1:9292","host2:9292"] flush_size => 10000 idle_flush_time => 2 index=>"logstash-task-%{taskId}-%{+YYYYMMdd}" } }
The number of connections of port 4561:
[root@logstash-01 ~]# netstat -apn | grep 4561 | wc -l 2069 [root@logstash-01 ~]#
[root@logstash-01 ~]# sysctl -a | grep keep net.ipv4.tcp_keepalive_intvl = 75 net.ipv4.tcp_keepalive_probes = 9 net.ipv4.tcp_keepalive_time = 1800