阿里云配置 keepalived

广大2年前技术文章878

1 安装 keepalived

yum install keepalived

mv /etc/keepalived/keepalived.conf /etc/keepalived/keepalived.conf.bak

2 配置

[root@rac1 ~]# vim /etc/keepalived/keepalived.conf

! Configuration File for 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_garp_interval 0

  vrrp_gna_interval 0

}


vrrp_instance VI_1 {

state MASTER           #设置ECS1实例为主实例

   interface eth0          #设置网卡名,本示例配置为eth0

   virtual_router_id 51

   nopreempt

   priority 100             #设置优先级,数字越大,优先级越高,本示例配置主用实例优先级为100

   advert_int 1

   authentication {

       auth_type PASS

       auth_pass 1111

   }

   unicast_src_ip 192.168.10.1   #设置ECS实例的私网IP地址

   unicast_peer {

       192.168.10.2           #对端ECS实例的私网IP地址

   }

   virtual_ipaddress {

       192.168.10.3          #设置HaVip的IP地址

       192.168.10.5

   }

   notify_master "/etc/keepalived/notify_action.sh MASTER"

   notify_backup "/etc/keepalived/notify_action.sh BACKUP"

   notify_fault "/etc/keepalived/notify_action.sh FAULT"

   notify_stop "/etc/keepalived/notify_action.sh STOP"

   garp_master_delay 1

   garp_master_refresh 5


       track_interface {

               eth0                #设置ECS实例网卡名,本示例配置为eth0

       }

}


vrrp_instance VI_2 {

state BACKUP           #设置ECS1实例为备用实例

   interface eth0          #设置网卡名,本示例配置为eth0

   virtual_router_id 52

   nopreempt

   priority 10             #设置优先级,数字越大,优先级越高,本示例配置备用实例优先级为10

   advert_int 1

   authentication {

       auth_type PASS

       auth_pass 1111

   }

   unicast_src_ip 192.168.10.1   #设置ECS实例的私网IP地址

   unicast_peer {

       192.168.10.2           #对端ECS实例的私网IP地址

   }

   virtual_ipaddress {

       192.168.10.4          #设置HaVip的IP地址

   }

   notify_master "/etc/keepalived/notify_action.sh MASTER"

   notify_backup "/etc/keepalived/notify_action.sh BACKUP"

   notify_fault "/etc/keepalived/notify_action.sh FAULT"

   notify_stop "/etc/keepalived/notify_action.sh STOP"

   garp_master_delay 1

   garp_master_refresh 5


       track_interface {

               eth0                #设置ECS实例网卡名,本示例配置为eth0

       }

}


service keepalived start  # 启动服务


[root@rac2 ~]# vim /etc/keepalived/keepalived.conf

! Configuration File for 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_garp_interval 0

  vrrp_gna_interval 0

}


vrrp_instance VI_1 {

state BACKUP           #设置ECS2实例为备用实例

   interface eth0          #设置网卡名,本示例配置为eth0

   virtual_router_id 51

   nopreempt

   priority 10             #设置优先级,数字越大,优先级越高,本示例配置备用实例优先级为10

   advert_int 1

   authentication {

       auth_type PASS

       auth_pass 1111

   }

   unicast_src_ip 192.168.10.2  #设置ECS实例的私网IP地址

   unicast_peer {

       192.168.10.1          #对端ECS实例的私网IP地址

   }

   virtual_ipaddress {

       192.168.10.3          #设置HaVip的IP地址

       192.168.10.5

   }

   notify_master "/etc/keepalived/notify_action.sh MASTER"

   notify_backup "/etc/keepalived/notify_action.sh BACKUP"

   notify_fault "/etc/keepalived/notify_action.sh FAULT"

   notify_stop "/etc/keepalived/notify_action.sh STOP"

   garp_master_delay 1

   garp_master_refresh 5


       track_interface {

               eth0                #设置ECS实例网卡名,本示例配置为eth0

       }

}


vrrp_instance VI_2 {

state MASTER           #设置ECS1实例为主实例

   interface eth0          #设置网卡名,本示例配置为eth0

   virtual_router_id 52

   nopreempt

   priority 100             #设置优先级,数字越大,优先级越高,本示例配置主用实例优先级为100

   advert_int 1

   authentication {

       auth_type PASS

       auth_pass 1111

   }

   unicast_src_ip 192.168.10.2   #设置ECS实例的私网IP地址

   unicast_peer {

       192.168.10.1           #对端ECS实例的私网IP地址

   }

   virtual_ipaddress {

       192.168.10.4          #设置HaVip的IP地址

   }

   notify_master "/etc/keepalived/notify_action.sh MASTER"

   notify_backup "/etc/keepalived/notify_action.sh BACKUP"

   notify_fault "/etc/keepalived/notify_action.sh FAULT"

   notify_stop "/etc/keepalived/notify_action.sh STOP"

   garp_master_delay 1

   garp_master_refresh 5


       track_interface {

               eth0                #设置ECS实例网卡名,本示例配置为eth0

       }

}


service keepalived start  # 启动服务



相关文章

开源大数据集群部署(十八)Hive 安装部署

开源大数据集群部署(十八)Hive 安装部署

2.7.1创建hive Kerberos主体bash /root/bigdata/getkeytabs.sh /etc/security/keytab/hive.keytab hive2.7.2 安装...

从Docker拉取镜像一直失败超时?这些解决方案帮你解决烦恼

设置国内源:提示:常规方案(作用不大)阿里云提供了镜像源:https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors 登录后你会获得一个专属...

MySQL运维实战(4.2) 关于SQL_MODE

早期mysql对一些不符合SQL标准的SQL语句和数据的容忍度比较高。mysql 5.7 修改了默认sql mode。系统从低版本升级或迁移到高版本时,需要经过全面的测试,避免影响程序的正常运行。5....

 oracle11g打补丁31718723报错Operation not permitted

oracle11g打补丁31718723报错Operation not permitted

oracle11g 在打gi补丁的时候报错如下:原因:参考mos(Doc ID 2668094.1)可知因为Linux/Unix平台上,安装后一些Oracle可执行文件的权限需要修改成root。这是以...

Zeppelin简介

1.    Zeppelin1.1.  Zeppelin是什么zeppelin是一个非常流行的开源数据探索分析平台。zeppelin集成了非...

trino容器对接hudi(五)

trino容器对接hudi(五)

前提:本文是基于已经部署了trino容器的基础上进行的。冒烟测试是在trino对接ldap后并且ranger已经对接了metastore权限后,并且spark组件已经对接hudi,并且成功创建hudi...

发表评论    

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。