前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >00-Ubuntu20.04下二进制部署keepalived

00-Ubuntu20.04下二进制部署keepalived

原创
作者头像
志新
修改2021-09-13 10:20:10
6700
修改2021-09-13 10:20:10
举报
文章被收录于专栏:求知

#sudo ufw disalbe

#sudo systemctl disalbe ufw

#sudo apt-get upgrade -y && apt-get update -y

#sudo apt-get install net-tools ntp make gcc libssl-dev openssl -y

#sudo cd /usr/src

#sudo tar -xf keepalived-2.2.4.tar.gz

#sudo cd keepalived-2.2.4/

#sudo ./configure //编译

#sudo make

#sudo make install

#sudo mkdir /etc/keepalived

#sudo cp /usr/local/etc/keepalived/keepalived.conf /etc/keepalived/keepalived.conf //根据模板修改配置文件

#sudo vim /etc/keepalived/keepalived.conf

代码语言:shell
复制
! 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 master01.matrix.com  //路由id标识
   vrrp_skip_check_adv_add
   #vrrp_strict 
   vrrp_garp_interval 1
   vrrp_gna_interval 1
}
vrrp_instance VI_1 {
    state MASTER //角色标识,只起标识作用,BACKUP
    interface ens32 //接口
    virtual_router_id 51
    priority 100 //优先级,值越大越优先
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass matrix //邻居认证密码
    }
    virtual_ipaddress {
        192.168.63.151 dev ens32 label ens32:51 //虚拟IP
    }
}

#sudo cp /usr/src/keepalived-2.2.4/keepalived/keepalived.service /usr/lib/systemd/system/keepalived.service

#keepalived -t //测试keepalived配置

#sudo systemctl start keepalived.service

#sudo systemctl enable keepalived.service

使用命令验证

#systemctl status keepalived.service

#hostname -I //查看虚拟IP在哪个节点上

#ip a //查看网卡的IP

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档