keepalived 几种健康监测方式
2015-12-07 09:27
525 查看
一./etc/keepalived/keepalived.conf
! Configuration File for keepalived
global_defs {
notification_email {
test@abc.com
}
notification_email_from test@abc.com
smtp_server 127.0.0.1
smtp_connect_timeout 30
router_id wfc
}
vrrp_instance VI_1 {
state MASTER
interface eth0
virtual_router_id 51
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass pass_wfc
}
virtual_ipaddress {
10.21.10.32
}
}
virtual_server 10.21.10.32 6667 {
delay_loop 6
lb_algo wlc
lb_kind DR
ops
persistence_timeout 50
protocol TCP
nat_mask 255.255.255.0
include realserver_wfc
}
二./etc/keepalived/realserver_wfc
1.80 port
real_server 10.21.10.30 80 {
weight 1
HTTP_GET {
url {
path /keeptest/index.html
digest 3b9bc8d36a113971683321ad4fa02daf
}
connect_timeout 10
nb_get_retry 3
delay_before_retry 3
}
}
/usr/bin/genhash -s 10.21.10.30 -p 80 -u /keeptest/index.html
2.自带检测
/etc/keepalived/realserver_wfc
real_server 10.21.10.30 80 {
weight 4
include only_tcp_80
}
/etc/keepalived/only_tcp_80
TCP_CHECK {
connect_timeout 5
connect_port 80
}
3.脚本检测
/etc/keepalived/realserver_wfc
real_server 10.21.10.30 80 {
weight 1
MISC_CHECK {
misc_path "/etc/keepalived/check_port.sh 10.21.10.30 80"
misc_timeout 10
}
}
4.脚本如下
/etc/keepalived/check_port.sh
#!/bin/bash
/usr/bin/nc -z -w1 $1 $2 | grep succeeded > /dev/null
exit $?
! Configuration File for keepalived
global_defs {
notification_email {
test@abc.com
}
notification_email_from test@abc.com
smtp_server 127.0.0.1
smtp_connect_timeout 30
router_id wfc
}
vrrp_instance VI_1 {
state MASTER
interface eth0
virtual_router_id 51
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass pass_wfc
}
virtual_ipaddress {
10.21.10.32
}
}
virtual_server 10.21.10.32 6667 {
delay_loop 6
lb_algo wlc
lb_kind DR
ops
persistence_timeout 50
protocol TCP
nat_mask 255.255.255.0
include realserver_wfc
}
二./etc/keepalived/realserver_wfc
1.80 port
real_server 10.21.10.30 80 {
weight 1
HTTP_GET {
url {
path /keeptest/index.html
digest 3b9bc8d36a113971683321ad4fa02daf
}
connect_timeout 10
nb_get_retry 3
delay_before_retry 3
}
}
/usr/bin/genhash -s 10.21.10.30 -p 80 -u /keeptest/index.html
2.自带检测
/etc/keepalived/realserver_wfc
real_server 10.21.10.30 80 {
weight 4
include only_tcp_80
}
/etc/keepalived/only_tcp_80
TCP_CHECK {
connect_timeout 5
connect_port 80
}
3.脚本检测
/etc/keepalived/realserver_wfc
real_server 10.21.10.30 80 {
weight 1
MISC_CHECK {
misc_path "/etc/keepalived/check_port.sh 10.21.10.30 80"
misc_timeout 10
}
}
4.脚本如下
/etc/keepalived/check_port.sh
#!/bin/bash
/usr/bin/nc -z -w1 $1 $2 | grep succeeded > /dev/null
exit $?
相关文章推荐
- mysql集群之keepalived简单搭建
- LVS+Keepalived构建高可用负载均衡(测试篇)
- haproxy+keepalived实现高可用负载均衡(理论篇)
- haproxy+keepalived实现高可用负载均衡(实例配置)
- LVS+Keepalived构建高可用负载均衡配置方法(配置篇)
- keepalived之VRRP
- keepalived-2-配置文件详解
- mysql使用keepalived搭建双master
- 搭建mysql负载均衡及高可用环境
- Keepalived安装错误一例(make错误) 1.2.2
- keepalived+lvs_dr
- 中型网站架构部署笔记----HAproxy+keepalived
- 搭建高可用及负载均衡的REDIS
- Keepalived+LVS+Mysql-Cluster(7.1.10)架构方案
- nginx+keepalived 双机互备
- keepalived 安装配置
- RHEL6平台Keepalived+LVS+iSCSI+GFS搭建高可用负载均衡Web集群
- keepalived实现LVS的高可用以及实现web服务的高可用(主从模型、双主模型)
- Keepalived原理与实战精讲
- keepalived之vrrp_script篇