(?)企业部分之HA集群

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了(?)企业部分之HA集群相关的知识,希望对你有一定的参考价值。

需要三台纯净的虚拟机,server3作为

server1:172.25.45.1

server2:172.25.45.2

server3:172.25.45.3

 

server1,server2

1.重新配置yum

vim dvd.repo

内容

rum repolist

 

2.配置/etc/hosts文件

 

3.yum install -y ricci

 

4.echo westos | passwd --stdin ricci

 

5.chkconfig ricci on

/etc/init.d/ricci start

 

server3

1.重新配置yum

vim dvd.repo

内容

rum repolist

 

2.配置/etc/hosts文件(物理机也需要)

 

3.yum install httpd

/etc/init.d/httpd start

 

4.yum install -y luci

[[email protected] ~]# rpm -q luci

luci-0.26.0-48.el6.x86_64

 

/etc/init.d/luci start

Starting saslauthd:                                        [  OK  ]

Start luci...                                              [  OK  ]

Point your web browser to https://server6.example.com:8084 (or equivalent) to access luci

 

https://server3.example.com:8084

 

 

图图图

 

 

如果过程中重复创建会报错

解决方法:

rm -rf /etc/cluster/cluster.conf

重启服务(???待验证)

 

 

2.fence

【物理机】

yum search fence

 

yum

fence-virtd.x86_64 : Daemon which handles requests from fence-virt

fence-virtd-libvirt.x86_64 : Libvirt backend for fence-virtd**

fence-virtd-multicast.x86_64 : Multicast listener for fence-virtd**

fence-virtd-serial.x86_64 : Serial VMChannel listener for fence-virtd

fence-virt.x86_64 : A pluggable fencing framework for virtual machines**

(大概要下这三个,,,待验证)

 

yum install fence-virt.x86_64 fence-virtd-multicast.x86_64 fence-virtd-libvirt.x86_64

 

[[email protected] ~]# rpm -qa | grep fence

fence-virtd-libvirt-0.3.0-16.el7.x86_64

fence-virtd-0.3.0-16.el7.x86_64

fence-virtd-serial-0.3.0-16.el7.x86_64

fence-virtd-multicast-0.3.0-16.el7.x86_64

fence-virt-0.3.0-16.el7.x86_64

 

(可能会需要手动建立一个目录  mkdir /etc/cluster

fence_virtd -c

 

会覆盖/etc/fence_virt.conf

 

netstat -anulp | grep :1229

 

dd if=/dev/urandom of=fence_xvm.key bs=128 count=1

 

file fence_xvm.key

 

systemctl restart fence_virtd

 

scp /etc/cluster/fence_xvm.key [email protected]1:/etc/cluster/

scp /etc/cluster/fence_xvm.key [email protected]2:/etc/cluster/

 

virsh list(图)

 

server1/server2

clustat

 

 

网页

图图图

 

 

测试:

server2

fence_node server2.example.com    ##远程断电server2

 

 

3.webfail

server1/server2

yum install httpd

echo server1.example.com > index.html

echo server2.example.com > index.html

 

图图图

 

测试:

h(此时是server1

clusvcadm -r apache -m server2.example.com##访问server2

h(此时是server2

 

/etc/init.d/network stop##关掉server1的网络服务

server1挂掉,自动重启

clustatserver2  h

 

echo c > /proc/sysrq-trigger##崩溃

server1挂掉,自动重启

clustatserver2  h

以上是关于(?)企业部分之HA集群的主要内容,如果未能解决你的问题,请参考以下文章

构建Hadoop高可用性HA集群

企业~heartbeat&drbd

(?)企业部分之redis

(?)企业部分之puppet

企业部分之cacti

企业部分之Varnish