zoukankan      html  css  js  c++  java
  • slave 成为master 时候执行的操作notify_master /etc/keepalived/send_master.sh

    slave:/root# cat /etc/keepalived/keepalived.conf
    global_defs {
       router_id MySQL-ha
    }
    
    
    vrrp_instance VI_1{
    # 在初始化状态下定义为主设备
    state BACKUP
    # 注意网卡接口
    interface eth1
    virtual_router_id 71
    # 优先级,另一台改为90
    priority 90
    advert_int 1
    # 不主动抢占资源
    nopreempt
    authentication {
    # 认证方式,可以是PASS或AH两种认证方式
    auth_type PASS
    # 认证密码
    auth_pass 1111
    }
    
    virtual_ipaddress {
    # 虚拟IP地址,随着state的变化而增加删除
    192.168.32.66
    }
    notify_master /etc/keepalived/send_master.sh
    }
    
    virtual_server 192.168.32.66 3306 {
    # 每个2秒检查一次real_server状态
    delay_loop 2
    # LVS算法
    lb_algo wrr
    # LVS模式
    lb_kind DR
    # 会话保持时间
    persistence_timeout 60
    protocol TCP
    
    real_server 192.168.32.116 3306 {
    # 权重
    weight 3
    # 检测到服务down后执行的脚本
    notify_down /etc/keepalived/keepalived.sh
    TCP_CHECK {
    # 连接超时时间
    connect_timeout 10
    # 重连次数
    nb_get_retry 3
    # 重连间隔时间
    delay_before_retry 3
    # 健康检查端口
    connect_port 3306
    }
    }
    } 
    slave:/root# cat /etc/keepalived/send_master.sh
    . ~/.bash_profile
    perl /root/sbin/smail.pl "wo haha"

  • 相关阅读:
    Kubernetes
    桥接模式
    原型模式
    工厂模式
    生成器模式
    Java-Sentinel限流中间件
    python模拟发送、消费kafka消息
    使用idea搭建springBoot项目
    linux 虚拟机不能启动不了系统,虚拟机更改linux初始启动5,出现无法启动现象
    vwware workstation虚机网络配置NAT
  • 原文地址:https://www.cnblogs.com/zhaoyangjian724/p/6199411.html
Copyright © 2011-2022 走看看