江湖浪人 发表于 2015-11-19 14:37:48

keepalived HTTP_GET健康检查配置

     Keepalived HTTP_GET健康检查配置方式有2种:摘要 和 状态。
   一、摘要
  这种方法当index.html变化,摘要消息需重新计算。
  

real_server 192.168.36.99 80 {
weight 1
HTTP_GET {
url {
path /index.html
digest bfaa334fdd71444e45eca3b7a1679a4a#http://192.168.36.99/index.html的digest值         
}
connect_timeout 3
nb_get_retry 3
delay_before_retry 3
}
}
  
  digest值的获取方法:
  >genhash -s 192.168.36.99 -p 80 -u /index.html
  MD5SUM = bfaa334fdd71444e45eca3b7a1679a4a
  genhash命令:
  genhash v1.0.0 (21/07, 2013)
  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 --hash            -H       Use the specified hash algorithm.
  genhash --verbose         -v       Use verbose mode output.
  genhash --help            -h       Display this short inlined help screen.
  genhash --release         -r       Display the release number
  Supported hash algorithms:
  MD5 (default)
  二、HTTP状态
  

real_server 192.168.36.99 80 {
weight 1
HTTP_GET {
url {
path /index.html
status_code 200      #http://192.168.36.99/index.html的返回状态码
}
connect_timeout 3
nb_get_retry 3
delay_before_retry 3
}
}
  
页: [1]
查看完整版本: keepalived HTTP_GET健康检查配置