keepalived健康检查 HTTP_GET
一:
real_server 192.168.2.188 80 {
weight 1
HTTP_GET {
url {
path /index.html
digest bfaa334fdd71444e45eca3b7a1679a4a #http://192.168.2.188/index.html的digest值 }
connect_timeout 3
nb_get_retry 3
delay_before_retry 3
}
digest值的获取方法:
[root@188-test html]# genhash -s 192.168.2.188 -p 80 -u /index.html
MD5SUM = bfaa334fdd71444e45eca3b7a1679a4a
genhash命令:
[root@188-test html]# genhash
genhash v1.0.0 (18/11, 2002)
Usage:
genhash -s server-address -p port -u url
genhash -S -s server-address -p port -u url
genhash -h
genhash -r
Commands:
Either long or short options are allowed.
genhash --use-ssl -S Use SSL connection to remote server.
genhash --server -s Use the specified remote server address.
genhash --port -p Use the specified remote server port.
genhash --url -u Use the specified remote server url.
genhash --use-virtualhost -V Use the specified virtualhost in GET query.
genhash --verbose -v Use verbose mode output.
genhash --help -h Display this short inlined help screen.
genhash --release -r Display the release number
二:
real_server 192.168.2.188 80 {
weight 1
HTTP_GET {
url {
path /index.html
status_code 200 #http://192.168.2.188/index.html的返回状态码
}
connect_timeout 3
nb_get_retry 3
delay_before_retry 3
}
转载于:https://blog.51cto.com/nebula/1259637