集羣
安裝軟件
1.都把yum源改成:
# repos on instructor for cla***oom use
# Main rhel6.5 server
[base]
name=Instructor Server Repository
baseurl=ftp://172.25.99.250/pub/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
# HighAvailability rhel6.5
[HighAvailability]
name=Instructor HighAvailability Repository
baseurl=ftp://172.25.99.250/pub/HighAvailability
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
# LoadBalancer packages
[LoadBalancer]
name=Instructor LoadBalancer Repository
baseurl=ftp://172.25.99.250/pub/LoadBalancer
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
# ResilientStorage
[ResilientStorage]
name=Instructor ResilientStorage Repository
baseurl=ftp://172.25.99.250/pub/ResilientStorage
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
# ScalableFileSystem
[ScalableFileSystem]
name=Instructor ScalableFileSystem Repository
baseurl=ftp://172.25.99.250/pub/ScalableFileSystem
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
2.安裝
服務端:
yum install -y luci
[root@redhat5 ~]# /etc/init.d/luci start
Adding following auto-detected host IDs (IP addresses/domain names), corresponding to `redhat4.example.com' address, to the configuration of self-managed certificate `/var/lib/luci/etc/cacert.config' (you can change them by editing `/var/lib/luci/etc/cacert.config', removing the generated certificate `/var/lib/luci/certs/host.pem' and restarting luci):
(none suitable found, you can still do it manually as mentioned above)
Generating a 2048 bit RSA private key
writing new private key to '/var/lib/luci/certs/host.pem'
Starting saslauthd: [ OK ]
Start luci... [ OK ]
Point your web browser to https://redhat5.example.com:8084 (or equivalent) to access luci
[root@redhat5 ~]# chkconfig luci on
客戶端:(redhat3 redhat4)
yum install -y ricci
[root@redhat3 ~]# /etc/init.d/ricci start
Starting system message bus: [ OK ]
Starting oddjobd: [ OK ]
generating SSL certificates... done
Generating NSS database... done
Starting ricci: [ OK ]
[root@redhat3 ~]# chkconfig ricci on
給ricci一個密碼:
echo westos | passwd --stdin ricci
2創建集羣
密碼是redhat5的root密碼
創建一個集羣:
<下面應該寫redhat3.example.com 和 redhat4.example.com,,截圖>
如果有節點是紅的(未加入集羣的),肯定是缺少配置文件,就從正常的節點拷貝配置文件到沒有加入集羣的節點。
3配置fence
1.在真機foundation11上安裝fence
<不裝圖形的話,就不會安裝NetworkManager>
2創建fence :
主要是修改一下br0
3.創建fence
_[root@foundation99 ~]# cd /etc/
[root@foundation99 etc]# mkdir cluster
[root@foundation99 etc]# cd cluster/
[root@foundation99 cluster]# dd if=/dev/urandom of=/etc/cluster/fence_xvm.key bs=1024 count=1
1+0 records in
1+0 records out
1024 bytes (1.0 kB) copied, 0.000234166 s, 4.4 MB/s
[root@foundation99 cluster]# ls
fence_xvm.key
把這個key拷貝到集羣中的ricci節點:
[root@foundation99 cluster]# scp fence_xvm.key [email protected]:/etc/cluster/fence_xvm.key
4.啓動fence
systemctl start fence_virtd.service
使用fence
在server6上把server5 fence掉
就相當於把server5 斷電然後重啓。注意,-H後面接的是 virtual machine manager裏面的名字。不一定是hostname
裏面寫server3 server4的uuid
實驗結果:
如果:[root@redhat3 ~]# ifconfig eth0 down
那fence會把redhat 3關閉,然後重啓。
如果:[root@redhat3 ~]# echo c > /proc/sysrq-trigger
內核會崩潰,redhat3也會關閉並重啓。
配置文件會自動添加下面的行:
[root@redhat6 cluster]# ls
cluster.conf cman-notify.d fence_xvm.key
[root@redhat6 cluster]# cat cluster.conf
4.在集羣上配置http服務
1.添加Failover Domains
2.添加resources
這些在配置文件/etc/cluster/cluster.conf 裏面都會有的:
3.添加Resource Groups
點上面這個 “Add Resource”添加剛纔添加的resource. 一個IP 一個httpd