keepalived部署

2021-07-07 10:24:13 浏览数 (1)

部署

环境声明

代码语言:javascript复制
[web-server-1]
    主机名 = host-1
    系统 = centos-7.3
    地址 = 192.168.2.37
    软件 = keepaliveed-1.3.5
           httpd-2.4
[web-server-2]
    主机名 = host-1
    系统 = centos-7.3
    地址 = 192.168.2.149
    软件 = keepaliveed-1.3.5
          httpd-2.4

部署软件

(机器均操作) 1.安装keepavlied yum install keepalived -y

代码语言:javascript复制
#文件
/etc/keepalived/keepalived.conf     #keepalived服务主配置文件
/etc/rc.d/init.d/keepalived         #服务启动脚本
/etc/sysconfig/keepalived
/usr/bin/genhash
/usr/libexec/keepalived
/usr/sbin/keepalived

2.部署httpd(举例) yum -y install httpd systemctl start httpd

3.测试验证,看返回是否对应 (host-1操作) echo "37" >> /var/ww/html/index.html curl http://192.168.2.37

(host-2操作) echo "149" >> /var/ww/html/index.html curl http://192.168.2.149

0 人点赞