haproxy backend健康检查使用tcp检测时如何设置检查超时的时间默认检查超时时间是如何设定的
当使用TCP检测时,HAProxy的默认检查超时时间为2秒。您可以通过在backend中的option tcp-check指令后面添加timeout <time>来设置检查超时的时间。
例如,要将检查超时时间设置为5秒,您可以使用以下配置:
backend mybackend
mode tcp
option tcp-check
tcp-check expect string OK
tcp-check send GET /healthcheck HTTP/1.1\r\nHost:\ example.com\r\nConnection:\ close
timeout check 5s
server myserver 192.168.0.1:80 check
在上面的配置中,timeout check 5s指令将检查超时时间设置为5秒。请注意,您还可以根据您的需求调整超时时间。
原文地址: http://www.cveoy.top/t/topic/iJYd 著作权归作者所有。请勿转载和采集!