1. 安装keepalived高可用工具
1.1 切换目录到/usr/loca中
1.2 解压该压缩包tar -zxvf keepalived--1.2.18.tar.gz
1.3 切换目录到解压后的文件keepalived--1.2.18
1.4 yum install -y openssl openssl-devel
1.5 ./configure --prefix=/usr/local/keepalived 编译,将编译文件放到/usr/local/keepalived
1.6 make编译
1.7 make install安装
1.8 在/etc/keepalived 创建目录 mkdir /etc/keepalived
1.9 复制文件操作如下
1.10 cp /usr/local/keepalived/etc/keepalived/keepalived.conf /etc/keepalived/
1.11 cp /usr/local/keepalived/etc/rc.d/init.d/keepalived /etc/init.d/
1.12 cp /usr/local/keepalived/etc/sysconfig/keepalived /etc/sysconfig/
1.13 ln -s /usr/local/sbin/keepalived /usr/sbin/
1.14 ln -s /usr/local/keepalived/sbin/keepalived /sbin/
1.15 将nginx启动脚本和keepalived.conf配置上传到/etc/keepalived
1.16修改主机中的keepalived.conf文件
1.17 修改备机keepalived.conf文件
1.19 启动主机和备机后访问页面
1.20 现在将主机关闭后启动页面
1.21 keepalived 常用命令
启动Keepalived:service keepalived start