[官方doc: https://www.kernel.org/doc/Documentation/networking/ip-sysctl.txt]
tcp_keepalive_time - INTEGER
How often TCP sends out keepalive messages when keepalive is enabled.
Default: 2hours.
tcp_keepalive_probes - INTEGER
How many keepalive probes TCP sends out, until it decides that the
connection is broken. Default value: 9.
tcp_keepalive_intvl - INTEGER
How frequently the probes are send out. Multiplied by
tcp_keepalive_probes it is time to kill not responding connection,
after probes started. Default value: 75sec i.e. connection
will be aborted after ~11 minutes of retries.
tcp自带的保活机制是 每tcp_keepalive_time 发一次keepalive包,如果失败,就会隔tcp_keepalive_intvl 尝试发包tcp_keepalive_probes ,都没有收到就认为是断掉了,这个特性默认是关闭了,要在应用层开启。
基于tcp的长连接一般通过两种方式,
1.应用层自己实现ping 协议保活
2.使用tcp自带的keepalive 保活
这个问题主要来源于 connection reset by peer 参考了[https://blog.frognew.com/2018/12/kubernetes-ipvs-long-connection-optimize.html]
但是最后还是没有生效,我也不知道哪里的操作方式不对,主要对k8s 的转发以及容器本身不了解,也做了很多尝试
网友评论