1、TCP方式
详见:http://www.cnblogs.com/tengpan-cn/p/5776574.html
以下内容,都是基于此进行修改
2、HTTP_GET
根据返回状态判断服务器是否正常
HTTP_GET {
url {
path /
status_code #返回状态码
}
connect_timeout
nb_get_retry
delay_before_retry
}
或者根据HTTP返回的内容,判断服务器是否正常
HTTP_GET {
url {
path /HelloMaven
digest d41d8cd98f00b204e9800998ecf8427e #http://192.168.2.188/index.html的digest值
connect_timeout
nb_get_retry
delay_before_retry
}
}
摘要生成方法:
[root@mysql_01 keepalived]# genhash -s 192.168.91.232 -p -u /HelloMaven
MD5SUM = d41d8cd98f00b204e9800998ecf8427e
检测到tomcat挂掉后,自动重启:
real_server 192.168.91.231 {
weight
notify_down /home/panteng/apache-tomcat-7.0./bin/startup.sh
HTTP_GET {
url {
path /
status_code #返回状态码
}
connect_timeout
nb_get_retry
delay_before_retry
}
}