keepalived健康检查方式配置笔记
2013-03-20 16:09
555 查看
keepalived健康检查方式:HTTP_GET|SSL_GET|TCP_CHECK|SMTP_CHECK|MISC_CHECK
TCP健康检查方式
# SMTP健康检查方式
#MISC
其中 工具genhash使用
工具产生结果如下:
配置如下:
TCP健康检查方式配置例子:
SSL健康检查方式同HTTP,例子如下:
SNMP方式例子:
MISC方式脚本带参数例子:
MISC方式脚本不带参数例子:
参考keepalived权威指南和keepalived中的例子
HTTP_GET | SSL_GET { url { path / # HTTP/SSL 检查的url 可以是多个 digest <STRING> # HTTP/SSL 检查后的摘要信息 用工具genhash生成 status_code 200 # HTTP/SSL 检查返回的状态码 } connect_port 80 # 连接端口 bindto <IPADD> connect_timeout # 连接超时时间 nb_get_retry 3 # 重连次数 delay_before_retry 2 #连接间隔时间 } # END OF HTTP_GET|SSL_GET
TCP健康检查方式
TCP_CHECK { connect_port 80 bindto 192.168.1.1 connect_timeout 4 } # TCP_CHECK
# SMTP健康检查方式
SMTP_CHECK host { connect_ip <IP ADDRESS> connect_port <PORT> # 默认检查端口25 } connect_timeout <INTEGER> retry <INTEGER> delay_before_retry <INTEGER> # "请求命令参数,可选 helo_name <STRING>|<QUOTED-STRING> } #SMTP_CHECK
#MISC
健康检查方式MISC_CHECK { # 外部程序或者脚本路径 misc_path <STRING>|<QUOTED-STRING> # 执行脚本的超时时间 misc_timeout <INT> # XJ misc_dynamic{§ healthchecker§S misc_dynamic }
其中 工具genhash使用
[root@localhost bin]# ./genhash -h 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
工具产生结果如下:
[root@localhost bin]# ./genhash -s 10.7.11.12 -p 80 -u http://10.7.11 .40/index.html MD5SUM = b7bd8391367e4cf9e4e85263ce313ae8
配置如下:
real_server 10.7.11.12 80 { weight 1 TCP_CHECK { connect_timeout 5 nb_get_retry 3 delay_before_retry 3 connect_port 80 } HTTP_GET { url { path / digest b7bd8391367e4cf9e4e85263ce313ae8 status_code 200 } #url { #path /mrtg/ #digest 9b3a0c85a887a256d6939da88aabd8cd #} connect_timeout 3 nb_get_retry 3 delay_before_retry 3 } }
TCP健康检查方式配置例子:
real_server 192.168.191.130 80 { weight 3 inhibit_on_failure #在服务器健康检查失效时,将其设为0 TCP_CHECK { connect_timeout 5 #连接超时时间 nb_get_retry 3 #重连次数 delay_before_retry 3 #重连间隔时间 connect_port 80 #健康检查的端口 } }
SSL健康检查方式同HTTP,例子如下:
virtual_server 192.168.200.100 443 { delay_loop 6 lb_algo rr lb_kind NAT persistence_timeout 50 protocol TCP real_server 192.168.201.100 443 { weight 1 SSL_GET { url { path / digest ff20ad2481f97b1754ef3e12ecd3a9cc } url { path /mrtg/ digest 9b3a0c85a887a256d6939da88aabd8cd } connect_timeout 3 nb_get_retry 3 delay_before_retry 3 } } }
SNMP方式例子:
real_server 172.16.1.12 25 { weight 1 SMTP_CHECK { connect_timeout 10 retry 2 delay_before_retry 5 helo_name "foo.bar.com" host { connect_ip 172.16.1.12 connect_port 25 bindto 172.16.1.2 } host { connect_ip 192.168.155.11 connect_port 25 bindto 192.168.155.2 } host { connect_ip 64.233.167.100 connect_port 587 } } }
MISC方式脚本带参数例子:
real_server 192.168.200.6 1358 { weight 1 MISC_CHECK { misc_path "/usr/local/bin/script.sh arg1 arg2" } }
MISC方式脚本不带参数例子:
real_server 192.168.200.6 1358 { weight 1 MISC_CHECK { misc_path /usr/local/bin/script.sh ! misc_dynamic } }
参考keepalived权威指南和keepalived中的例子
相关文章推荐
- Keepalived健康检查方式配置
- keepalived健康检查方式
- keepalived HTTP_GET健康检查配置
- keepalived健康检查方式
- RabbitMQ+Keepalived之安装配置笔记
- 15分钟快速了解如何在Kubernetes中配置健康检查
- SSM框架笔记06:初探Spring——采用XML配置方式
- [原创]java WEB学习笔记103:Spring学习---Spring Bean配置:基于注解的方式(基于注解配置bean,基于注解来装配bean的属性)
- keepalived 几种健康监测方式
- 【JavaEE笔记】Struts2 (二) 结果页面配置 、获取表单提交数据 、提供获取表单数据方式 、获取数据封装到集合中
- 15分钟快速了解如何在Kubernetes中配置健康检查
- Spring4学习笔记-Spring4整合Struts2(基于配置文件的方式)
- Keepalived健康检查RST ACK疑问
- Unity学习笔记1-以配置文件方式注册组件
- 高速通道-冗余物理专线接入-健康检查配置
- 笔记之Spring的java配置方式
- Tengine笔记3:Nginx的反向代理和健康状态检查
- Spring4学习笔记-声明式事务(基于配置文件的方式)
- Cent OS上安装配置LVS(DR方式)+keepalived,实现负载均衡和双机热备
- keepalived健康检查 HTTP_GET