rhcs红帽插件及 轮循
server1:
yum install luci ricci -y
echo westos | passwd -stdin ricci
/etc/init.d/ricci start
chkconfig --list ricci
chkconfig ricci on
/etc/init.d/luci start
chkconfig luci on
server4:
yum install ricci -y
echo westos | passwd --stdin ricci
/etc/init.d/ricci start
yum install luci ricci -y
echo westos | passwd -stdin ricci
/etc/init.d/ricci start
chkconfig --list ricci
chkconfig ricci on
/etc/init.d/luci start
chkconfig luci on
server4:
yum install ricci -y
echo westos | passwd --stdin ricci
/etc/init.d/ricci start
编辑:
Failover Domains
添加:
![](https://img2018.cnblogs.com/blog/1443263/201809/1443263-20180925152503248-73773799.png)
Resources
添加:
![](https://img2018.cnblogs.com/blog/1443263/201809/1443263-20180925152623982-1006779684.png)
Service Groups
添加
![](https://img2018.cnblogs.com/blog/1443263/201809/1443263-20180925152649608-600007839.png)
测试:
server4:
clustat ##查看正在运行的节点
clustat ##查看正在运行的节点
![](https://img2018.cnblogs.com/blog/1443263/201809/1443263-20180925152720146-1123228528.png)
clusvcadm -r web -m server4 ##切换至server4
clustat
clustat
![](https://img2018.cnblogs.com/blog/1443263/201809/1443263-20180925152733739-1406311291.png)
clusvcadm -d web ##关闭服务
clusvcadm -e web ##开启服务
/etc/init.d/httpd stop
当一台apache服务停止,会自动切换另外一台服务器继承服务
当一台apache服务停止,会自动切换另外一台服务器继承服务
![](https://img2018.cnblogs.com/blog/1443263/201809/1443263-20180925152901110-1401660468.png)
物理机
yum install fence-virtd-0.3.2-5.el7.x86_64
yum install fence-virtd-libvirt.x86_64
yum install fence-virtd-multicast.x86_64
fence_virtd -c
mkdir /etc/cluster/
dd if=/dev/urandom of=/etc/cluster/fence_xvm.key bs=128 count=1
systemctl restart fence_virtd.service ##开启dence服务
yum install fence-virtd-0.3.2-5.el7.x86_64
yum install fence-virtd-libvirt.x86_64
yum install fence-virtd-multicast.x86_64
fence_virtd -c
mkdir /etc/cluster/
dd if=/dev/urandom of=/etc/cluster/fence_xvm.key bs=128 count=1
systemctl restart fence_virtd.service ##开启dence服务
scp fence_xvm.key server1:/etc/cluster/ ##将配置好的文件分发给server1和server4
scp fence_xvm.key server4:/etc/cluster/
在server2,3:
cd /etc/cluster/
ls
[root@server1 cluster]# ls
cluster.conf cman-notify.d fence_xvm.key
cd /etc/cluster/
ls
[root@server1 cluster]# ls
cluster.conf cman-notify.d fence_xvm.key
页面配置
Fence Devices
NOde
server1:
![](https://img2018.cnblogs.com/blog/1443263/201809/1443263-20180925153214369-1041970136.png)
server4:
![](https://img2018.cnblogs.com/blog/1443263/201809/1443263-20180925153223769-298338545.png)
此时当server1或server4中任何一台机子挂掉的话,另一台会接管服务,并自动重启挂掉的那台服务器。
实现轮循:
开启server2,server3
开启httpd服务
在eth0上添加虚拟ip
ip addr add 172.25.8.100/32 dev eth0
yum install arptables_jf
arptables -A IN -d 172.25.8.100 -j DROP
arptables -A OUT -s 172.25.8.100 -j mangle --mangle-ip-s 172.25.8.2
/etc/init.d/arptables_jf save
/etc/init.d/arptables_jf start
添加策略(如果已添加开启服务即可)
开启server2,server3
开启httpd服务
在eth0上添加虚拟ip
ip addr add 172.25.8.100/32 dev eth0
yum install arptables_jf
arptables -A IN -d 172.25.8.100 -j DROP
arptables -A OUT -s 172.25.8.100 -j mangle --mangle-ip-s 172.25.8.2
/etc/init.d/arptables_jf save
/etc/init.d/arptables_jf start
添加策略(如果已添加开启服务即可)
server1:
yum install ldirectord-3.9.5-3.1.x86_64.rpm -y
clusvcadm -d web
cd /etc/ha.d/
vim ldirectord.cf
yum install ldirectord-3.9.5-3.1.x86_64.rpm -y
clusvcadm -d web
cd /etc/ha.d/
vim ldirectord.cf
![](https://img2018.cnblogs.com/blog/1443263/201809/1443263-20180925154311168-69303065.png)
server4:
yum install ldirectord-3.9.5-3.1.x86_64.rpm -y
yum install ldirectord-3.9.5-3.1.x86_64.rpm -y
server1:
scp ldirectord.cf server4:/etc/ha.d
scp ldirectord.cf server4:/etc/ha.d
页面操作:
Resources
将ld脚本加入web
Resources
![](https://img2018.cnblogs.com/blog/1443263/201809/1443263-20180925154212572-1839720669.png)
Service Groups
将ld脚本加入web
server1:
clusvcadm -e web
ipvsadm -l
clusvcadm -e web
ipvsadm -l
![](https://img2018.cnblogs.com/blog/1443263/201809/1443263-20180925154246736-1884469475.png)
测试:
出现2和3的轮循效果
出现2和3的轮循效果
![](https://img2018.cnblogs.com/blog/1443263/201809/1443263-20180925154233425-1508816724.png)