VPS参考测评推荐
专注分享VPS主机优惠信息
衡天云优惠活动
华纳云优惠活动

45.Keepalived高可用群集

主机参考:VPS测评参考推荐/专注分享VPS服务器优惠信息!若您是商家可以在本站进行投稿,查看详情!此外我们还提供软文收录、PayPal代付、广告赞助等服务,查看详情!
我们发布的部分优惠活动文章可能存在时效性,购买时建议在本站搜索商家名称可查看相关文章充分了解该商家!若非中文页面可使用Edge浏览器同步翻译!PayPal代付/收录合作

Keepalived高可用群集

Keepalived high availability cluster

Keepalived采用VRRP热备份协议,以软件的方式实现linux服务器的多机热备功能,当一方故障时,自动切换备份服务器进行工作。

Keepalived uses VRRP hot backup protocol to realize the multi machine hot backup function of Linux server in the way of software. When one party fails, it will automatically switch the backup server to work.

Keepalived部署环境:一台主调度服务器,一台从调度服务器,多台节点服务器

Maintained deployment environment: one master scheduling server, one slave scheduling server, and multiple node servers

Keepalived部署步骤:

Steps of maintained deployment:

v 安装支持组件

V. install support components

#yum -y install kernel-devel openssl-devel popt-devel  ipvsadm

#yum -y install kernel-devel openssl-devel popt-devel  ipvsadm

v 源码安装keepalived工具

V. source code installation keepalived tool

#tar xzvf keepalived-1.2.13.tar.gz

#tar xzvf keepalived-1.2.13.tar.gz

#cd keepalived-1.2.13

#cd keepalived-1.2.13

#./configure --prefix=/ --with-kernel-dir=/usr/src/kernels/2.6.32-431.e16.x86_64

#./configure --prefix=/ --with-kernel-dir=/usr/src/kernels/2.6.32-431.e16.x86_64

#make make install

#make make install

v 配置主调度器

V. configure the main modulator

#vim /etc/keepalived/keepalived.conf

#vim /etc/keepalived/keepalived.conf

修改相关内容:

Modify relevant contents:

global_defs {

global_defs {

   router_id R1                 主调度器的名称

Router Ou ID R1 name of primary register

}

}

vrrp_instance VI_1 {

vrrp_instance VI_1 {

    state MASTER               主调度器的热备状态

State master the hot standby state of the primary register

    interface eth0               主调度器的下接口

Interface eth0 the lower interface of the main scheduler

    virtual_router_id 1           组号

Virtual router ID 1 group number

    priority 100                 优先级

Priority 100

    advert_int 1                 

    advert_int 1                 

    authentication {             主从热备认证信息

Authentication {master-slave hot standby authentication information

        auth_type PASS

        auth_type PASS

        auth_pass 1111

        auth_pass 1111

    }

}

    virtual_ipaddress {          群集虚拟IP地址

Virtual IP address {cluster virtual IP address

        1.1.1.100

        1.1.1.100

 

 

}

}

virtual_server 1.1.1.100 80 {       虚拟服务地址端口

Virtual server 1.1.1.100 80 {virtual service address port

    delay_loop 6               健康检查的间隔时间

Delay? Loop 6 interval between health checks

    lb_algo rr                  轮询的调度算法

The scheduling algorithm of lb'algo RR polling

    lb_kind DR                 直接路由的群集工作模式

The cluster working mode of LB · kind Dr direct routing

!    persistence_timeout 50      保持时间

! persistence > timeout 50

    protocol TCP                协议

Protocol TCP protocol

   real_server 1.1.1.1 80 {        真实服务器地址端口

Real server 1.1.1.1 80 {real server address port

        weight 1               权重

Weight 1

        TCP_CHECK {           健康检查方式

TCP? Check {health check method

            connect_port 80    检查目标端口

Connect? Port 80 check target port

            connect_timeout 3  连接超时

Connect? Timeout 3

            nb_get_retry 3      重试次数

NB get retry 3

            delay_before_retry 3 重试间隔

Delay? Before? Retry 3 retry interval

        }

        }

    }

}

}

}

v 重启keepalived服务

V. restart the maintained service

#Service keepalived restart

#Service keepalived restart

v 验证配置文件是否生效

V. verify that the configuration file is valid

#ip addr 查看是否自动创建了虚拟群集IP

#IP addr to check whether the virtual cluster IP is created automatically

v 配置从调度器

V. configure slave scheduler

#vim /etc/keepalived/keepalived.conf

#vim /etc/keepalived/keepalived.conf

修改内容:

Modification:

global_defs {

global_defs {

   router_id R2                 从调度器的名称

Router ﹣ ID R2 name of slave scheduler

}

}

vrrp_instance VI_1 {

vrrp_instance VI_1 {

    state BACKUP               从调度器的热备状态

State backup hot standby state of slave dispatcher

    interface eth0               从调度器的下接口

Interface eth0 from the lower interface of the scheduler

    virtual_router_id 1           组号

Virtual router ID 1 group number

    priority 99                  优先级

Priority 99

........其他内容相同

Other contents are the same

v 重启keepalived服务

V. restart the maintained service

#Service keepalived restart

#Service keepalived restart

v 配置节点服务器

V. configure node servers

#ifconfig lo:0 1.1.1.100/32

#ifconfig lo:0 1.1.1.100/32

#route add -host 1.1.1.100 dev lo:0

#route add -host 1.1.1.100 dev lo:0

#vim /etc/sysctl.conf

#vim /etc/sysctl.conf

添加内容:

Add content:

net.ipv4.conf.all.arp_ignore = 1

net.ipv4.conf.all.arp_ignore = 1

net.ipv4.conf.all.arp_announce = 2

net.ipv4.conf.all.arp_announce = 2

net.ipv4.conf.lo.arp_ignore = 1

net.ipv4.conf.lo.arp_ignore = 1

net.ipv4.conf.lo.arp_announce = 2

net.ipv4.conf.lo.arp_announce = 2

net.ipv4.conf.default.arp_ignore = 1

net.ipv4.conf.default.arp_ignore = 1

net.ipv4.conf.default.arp_announce = 2

net.ipv4.conf.default.arp_announce = 2

#sysctl -p

#sysctl -p

--------------------------------------------------------------
主机参考,收集国内外VPSVPS测评主机测评云服务器虚拟主机独立服务器,国内外服务器高性价比建站主机相关优惠信息@zhujicankao.com
详细介绍和测评国外VPS主机,云服务器,国外服务器,国外主机的相关优惠信息,商家背景,网络带宽等等,也是目前国内最好的主机云服务器VPS参考测评资讯优惠信息分享平台

这几篇文章你可能也喜欢:

本文由主机参考刊发,转载请注明:45.Keepalived高可用群集 https://zhujicankao.com/14145.html

【腾讯云】领8888元采购礼包,抢爆款云服务器 每月 9元起,个人开发者加享折上折!
打赏
转载请注明原文链接:主机参考 » 45.Keepalived高可用群集
主机参考仅做资料收集,不对商家任何信息及交易做信用担保,购买前请注意风险,有交易纠纷请自行解决!请查阅:特别声明

评论 抢沙发

评论前必须登录!