运维开发网

keepalived配置

运维开发网 https://www.qedev.com 2021-04-22 16:49 出处:51CTO 作者:妙手折花
高可用软件keepalived安装keepalivedyum install -y keepalived -y  #启动停止 查看状态 systemctl start keepalived.service systemctl stop keepalived.service systemctl status keepalived.service配置keepalived配置文件 :   /etc/k

高可用软件keepalived

安装keepalived

yum install -y keepalived -y 

#启动停止 查看状态
systemctl start keepalived.service
systemctl stop keepalived.service
systemctl status keepalived.service

配置keepalived

配置文件 :  
/etc/keepalived/keepalived.conf

精简配置文件:
!Config.....                        #这是注释,keepalived的注释是以 ! 开头.

global_defs {                       #全局邮件告警配置
   notification_email {
     acassen@firewall.loc
     failover@firewall.loc           #当服务发送切换或者节点发送故障时发送邮件.
     sysadmin@firewall.loc
   }
   notification_email_from Alexandre.Cassen@firewall.loc     #定义发送报警邮箱的地址信息.
   smtp_server 192.168.200.1         #定义发送邮件告警的服务器信息
   smtp_connect_timeout 30           #定义发送报警邮件连接服务器的超时时间
   router_id LVS_DEVEL               #定义路由保时信息,局域网唯一
   vrrp_skip_check_adv_addr
   vrrp_strict
   vrrp_garp_interval 0
   vrrp_gna_interval 0
}

vrrp_instance VI_1 {         #一个实例
    state MASTER             #定义 主 信息,需要定义优先级更高
    interface eth0           #网卡名
    Virtual_router_id 51     # routeid  id打的优先
    priority 100             # 优先级决定主和从,大的就是主 
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 1111         ##认证密码
    }
    Virtual_ipaddress {
        192.168.200.16
        192.168.200.17
        192.168.200.18
    }
}

配置邮件推送

vim /etc/mail.rc 结尾添加:

set bsdcompat
set from=a18816997176@163.com smtp=smtp.163.com
set smtp-auth-user=a18816997176  smtp-auth-password=pp1582 smtp-auth=login
0

精彩评论

暂无评论...
验证码 换一张
取 消