运维技术分享平台

 找回密码
 立即注册
首页
查看: 217|回复: 0

keeplaived配置

[复制链接]

296

主题

305

帖子

1705

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1705
发表于 2023-6-29 14:46:45 | 显示全部楼层 |阅读模式
本帖最后由 zhangkai 于 2023-7-13 11:57 编辑

精简版配置:
! Configuration File for keepalived
   
    global_defs {
        router_id lb01
    }
   
    vrrp_instance it {
        state MASTER
        interface eth0
        virtual_router_id 51
        priority 150
        advert_int 1
        authentication {
            auth_type PASS
            auth_pass 1111
        }
        virtual_ipaddress {
            10.0.0.100/24
        }
    }



第二版:
  ! Configuration File for keepalived
     global_defs {
       router_id lb01
    }

    vrrp_script check_web {
     script "/server/scripts/check_web.sh"  
     interval 3   
     weight 2
    }

    vrrp_instance it {
        state MASTER
        interface eth0
        virtual_router_id 51
        priority 150
        advert_int 1
        authentication {
            auth_type PASS
            auth_pass 1111
        }
        virtual_ipaddress {
         10.0.0.100/24
        }
       track_script {
             check_web
       }
    }


#!/bin/bash
nginxpid=`ps -C nginx --no-header | wc -l`
if [ $nginxpid -eq 0 ];then
        systemctl stop keepalived
        pkill -9 keepalived   
fi


       

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

首页

手机版|关于自己|运维技术分享平台

GMT+8, 2024-4-27 14:38 , Processed in 0.089517 second(s), 25 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc. Template By 【未来科技】【 www.wekei.cn 】

快速回复 返回顶部 返回列表