欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 编程资源 > 编程问答 >内容正文

编程问答

centos下 keepalived1.2.8配置文件

发布时间:2025/3/21 编程问答 43 豆豆
生活随笔 收集整理的这篇文章主要介绍了 centos下 keepalived1.2.8配置文件 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

一、软件配置文件

vrrp_script chk_http_port { script "/etc/keepalived/nginx_pid.sh" interval 2 weight 2 } global_defs {notification_email {308616473@qq.com}notification_email_from lizhuan@cdxfuture.comsmtp_server smtp.exmail.qq.comsmtp_connect_timeout 30router_id LVS_Twioo } vrrp_instance VI_1 {state BACKUPinterface eth0virtual_router_id 51mcast_src_ip 192.168.2.251priority 80advert_int 1smtp_alertauthentication {auth_type PASSauth_pass 123456 } virtual_ipaddress {192.168.2.88} track_script {chk_http_port }}virtual_server 192.168.2.88 80 {delay_loop 6lb_algo rrlb_kind DRpersistence_timeout 5protocol TCPreal_server 192.168.2.251 80 {weight 3TCP_CHECK {connect_timeout 10nb_get_retry 3delay_before_retry 3connect_port 80}}real_server 192.168.2.80 80 {weight 3TCP_CHECK {connect_timeout 3nb_get_retry 3delay_before_retry 3connect_port 80}} }

二、检测nginx是否正常检测文件


#!/bin/bashnginxpid=`ps -C nginx --no-header | wc -l` if [ $nginxpid -eq 0 ];theneth0 $nginxpid/usr/local/nginx/sbin/nginxsleep 1if [ $nginxpid -eq 0 ];then/etc/init.d/keepalived stopfi fi sleep 1~ ~ ~ ~ ~ ~ ~ ~


转载于:https://blog.51cto.com/lizhuan/1315136

总结

以上是生活随笔为你收集整理的centos下 keepalived1.2.8配置文件的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。