也可以通过修改/etc/sysctl.conf永久生效
$ grep net.ipv4.tcp_keepalive_time /etc/sysctl.conf
net.ipv4.tcp_keepalive_time = 300
$ sysctl -p|grep net.ipv4.tcp_keepalive_time
net.ipv4.tcp_keepalive_time = 300
CentOS 6.3下Haproxy+Keepalived+Apache配置笔记
Haproxy + KeepAlived 实现WEB群集 on CentOS 6