#yum install -y scsi-target-utils
#vim /etc/tgt/targets.conf
<target iqn.2017-03.cn.tedu.nsd1611:clu>
backing-store /dev/vdb1
initiator-address 192.168.4.1
initiator-address 192.168.4.2
initiator-address 192.168.2.1
initiator-address 192.168.2.2
</target>
#service tgtd start;chkconfig tgtd on
#tgt-admin -s (必须能看到LUN1,说明共享了)
6.在vh01和vh02上配置iscsi客户端
#yum install -y iscsi-initiator-utils
#man iscsiadm
#iscsiadm --mode discoverydb --type sendtargets --portal 192.168.2.3 --discover
#iscsiadm --mode discoverydb --type sendtargets --portal 192.168.4.3 --discover
#service iscsi restart
#chkconfig iscsi on; chkconfig iscsid on
7。在vh01和vh02配置多路径
vh01:
# yum -y install device-mapper-multipath
#mpathconf --user_friendly_names n
# scsi_id --whitelisted --device=/dev/sda
1IET 00010001
#vim /etc/multipath.conf
25 defaults {
26 user_friendly_names no
27 getuid_callout "lib/udev/scsi_id --whitelisted --device=/dev/%n"
28 }
29
30 multipaths {
31 multipath {
32 wwid "1IET 00010001"
33 alias mpatha
34 }
35 }
#service multipathd restart; chkconfig multipathd on
#ls /dev/mapper
mpatha 。。。。
#lsblk
vh02:
#yum -y install device-mapper-multipath
vh01:
#scp /etc/multipath.conf root@201.1.1.2:/etc/
vh02:
#service multipathd restart; chkconfig multipathd on
#ls /dev/mapper
mpatha 。。。。
#lsblk (发现两条路径)
8.在vh01和vh02上安装ricci
#yum -y install ricci
#echo 123456 |passwd --stdin ricci
#service ricci start; chkconfig ricci on
9.在vh03上安装luci(web管理工具,想在哪管理就安装在哪)
#yum -y install -y luci
service luci start; chkconfig ricci on
10.在物理机上(192.168.4.254)连接https://vh03.private.tedu.cn:8084/ ++++(8804?)
接受信任 用户名是:vh03的root 还有密码
在/etc/hosts/添加:(才能访问)
201.1.1.1 vh01.public.tedu.cn
201.1.2.1 vh01.private.tedu.cn vh01
201.1.1.2 vh02.public.tedu.cn
201.1.2.2 vh02.private.tedu.cn vh02
201.1.2.3 vh03.private.tedu.cn vh03
201.1.2.254 host.tedu.cn
11.
进入web页面后(添加节点):
Node Name Password Ricci Hostname Ricci Port
vh01.private.tedu.cn 123456 vh01.private.tedu.cn
vh02.private.tedu.cn 123456 vh02.private.tedu.cn
12.在物理主机上(192.168.4.254)配置fence服务
# yum -y install fence-virtd fence-virtd-libvirt fence-virtd-multicast
#fence_virtd -c
一直默认出现下面再改
Interface [none]: public2
Backend module [checkpoint]: libvirt
Replace /etc/fence_virt.conf with the above [y/N]? y
# dd if=/dev/urandom of=/etc/cluster/fence_xvm.key bs=4k count=1 (urandom生成的一个4k随机的字符,如果是zero生成的全部是0就是空白,安全系数不高)
记录了1+0 的读入
记录了1+0 的写出
4096字节(4.1 kB)已复制,0.00125856 秒,3.3 MB/秒
[root@room1pc01 桌面]# scp /etc/cluster/fence_xvm.key root@201.1.2.1:/etc/cluster/
[root@room1pc01 桌面]# ^2.1^2.2
[root@room1pc01 桌面]# service fence_virtd start; chkconfig fence_virtd on
13.在web页面上配置Fence Devices,先配置Nodes(节点)
14.在web页面上配置failover domain
15.配置web集群资源Resources
1)在两个节点上安装apache,但是不要起服务
2)创建floating ip(vip)资源
3)共享存储:
vh01:
# parted /dev/mapper/mpatha
(parted) mktab gpt
(parted) mkpart primary ext4 1M 10%
(parted) quit
# mkfs.ext4 /dev/mapper/mpathap1
# lsblk
vh02:
# partprobe;multipath -rr
# lsblk
#mount /dev/mapper/mpathap1 /dvar/www/html
#vim /var/www/html/index.html
<marquee><font size="30" color="red">RHCS WEB SITE</font></marquee>
#umount /var/www/html/
16.把资源组合成资源组,资源组就是一个集群服务
在web页面上提交之前,先在vh02上运行
#clustat -i 1