一、更改配置yum源
1.备份:mv
/etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2.下载阿里源:wget -O
/etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
3.缓存:yum makecache
1.yum -y install lrzsz
三、安装keepalived
1.yum -y install keepalived
2.创建目录
mkdir /data/UnicomSMS/Keepalived
mkdir /data/UnicomSMS/Keepalived/lock
mkdir /data/UnicomSMS/Keepalived/lock/subsys
四、修改配置文件
Master
[if !vml]
[endif]
Slave
[if !vml]
[endif]
Nginx检查脚本
[if !vml]
[endif]
五、启动测试
/etc/init.d/keepalived
start
[if !vml]
[endif]
六、VIP漂移测试
正常情况
[if !vml]
[endif]
停到主上的keepalived vip地址会飘向备
[if !vml]
[endif]
在把主上的keepalived启动vip会抢占到主
[if !vml]
[endif]
七、方便管理
1.ln -s /var/lock/subsys/keepalived /data/UnicomSMS/Keepalived/lock/subsys/
2.ln -s /etc/keepalived/keepalived.conf /data/UnicomSMS/Keepalived/
3.ln -s /etc/keepalived/nginx_check.sh/data/UnicomSMS/Keepalived/