收藏 分享(赏)

红帽子RHCS虚拟化解决方案.doc

上传人:HR专家 文档编号:6555065 上传时间:2019-04-17 格式:DOC 页数:74 大小:9.06MB
下载 相关 举报
红帽子RHCS虚拟化解决方案.doc_第1页
第1页 / 共74页
红帽子RHCS虚拟化解决方案.doc_第2页
第2页 / 共74页
红帽子RHCS虚拟化解决方案.doc_第3页
第3页 / 共74页
红帽子RHCS虚拟化解决方案.doc_第4页
第4页 / 共74页
红帽子RHCS虚拟化解决方案.doc_第5页
第5页 / 共74页
点击查看更多>>
资源描述

1、基于红帽企业版 Linux RHEL5U2 的 GFS2ISCSI虚拟化Cluster 的高可用性解决方案 史应生基于红帽企业版 Linux RHEL5U2GFS2ISCSI虚拟化 XENCluster的高可用性(HA)解决方案最新技术版- 1 -基于红帽企业版 Linux RHEL5U2 的 GFS2ISCSI虚拟化Cluster 的高可用性解决方案 史应生背景介绍:本方案结合红帽公司当前的主流技术和各软件最高的发行版本: 并发文件系统技术 -GFS2, 基于 IP 协议的 SAN 技术 -ISCSI, 虚拟化与活迁移技术 -Virtualization(Xen)+Live Migratio

2、n, 红帽集群套件 -RHCS(支持虚拟化服务,全新的基于 web 的 conga 配置界面)在红帽企业版高级平台上,设计和搭架了一套高可用性解决方案。适用读者:1中/高级 Linux 系统管理员2系统集成商3解决方案构架师4所有从事开源的爱好者注:在本文章中,我只讲述了如何成功配置的步骤,对每个技术的原理和优点不做说明.- 2 -基于红帽企业版 Linux RHEL5U2 的 GFS2ISCSI虚拟化Cluster 的高可用性解决方案 史应生目录第一章 系统结构图 5第二章 物理机系统安装和配置 82.1 安装和配置 ISCSITARGET 机器.82.2 配置 ISCSITARGET 服务

3、端 .92.3 安装 PHYSICAL1 物理机 .102.4 配置 PHYSICAL1 的 ISCSI-INITIATOR 客户端 112.5 安装 PHYSICAL2 物理机 .132.6 配置 PHYSICAL2 的 ISCSI-INITIATOR 客户端 142.7 配置 PHYSICAL1 和 PHYSICAL2 支持 CLVM .15第三章 配置 DOM0-CLUSTER . 163.1 在 ISCSITARGET 机器上配置 LUCI 163.2 创建 DOM0-CLUSTER 基本框架.173.3 设置共享存储 .223.4 安装虚拟机 .293.5 虚拟机的 LIVE MIG

4、RATION .383.6 为 DOM0-CLUSTER 配置 FAILOVER DOMAIN 403.7 为 DOM0-CLUSTER 创建虚拟机服务.423.8 为 DOM0-CLUSTER 添加 FENCE 设备47第四章 配置 APACHE-CLUSTER . 534.1 创建 APACHE-CLUSTER 基本框架 .534.2 为 APACHE-CLUSTER 配置 FAILOVER DOMAIN 544.3 为 APACHE-CLUSTER 添加资源 .564.4 为 APACHE-CLUSTER 添加服务 .594.5 为 APACHE-CLUSTER 添加 FENCE 设备

5、62第五章 系统测试 . 685.1 PHYSICAL1-VIRT1 虚拟机宕机测试 68- 3 -基于红帽企业版 Linux RHEL5U2 的 GFS2ISCSI虚拟化Cluster 的高可用性解决方案 史应生5.2 PHYSICAL1 物理机宕机测试69- 4 -基于红帽企业版 Linux RHEL5U2 的 GFS2ISCSI虚拟化Cluster 的高可用性解决方案 史应生第一章 系统结构图在本系统中,我们使用了三台物理机器,图 1.1 是系统的结构图:IS C I- T a r g e tis c s ita r g e t.s y s .c o mD o m U :D o m 0

6、:p h y s ic a l1 .s y s .c o mp h y s ic a 1 -v ir t1 .s y s .c o mD o m 0 :p h y s ic a l2 .s y s .c o mD o m U :p h y s ic a 2 -v ir t1 .s y s .c o m图 1.1 系统结构图所有的机器(物理机和虚拟机)都位于 这个域中.下表 1.1 是每台机器的分工:- 5 -基于红帽企业版 Linux RHEL5U2 的 GFS2ISCSI虚拟化Cluster 的高可用性解决方案 史应生机器名称 系统的优点: 作用与身份 iscsi 的 target 服务

7、器,把本地硬盘上的分区通过 iscsi 共享给iscsi 的 initiator 客户端。 使用 conga 配置界面的 luci 服务器端。 物理机的 dom0,在它的上面可以安装多个 domU,在本方案中我们安装了一个 domu:physical1-。 iscsi 的 initiator 客户端. 物理机的 dom0,在它的上面可以安装多个 domU,在本方案中我们安装了一个 domu:physical2-。 iscsi 的 initiator 客户端。表 1.1 机器分工表1. 使用了基于 iscsi 的 IP-SAN 技术,取代了价格昂贵的 SCSI 或者光纤 SAN 存储。2. 使用

8、了并发文件系统 GFS2,提高了文件系统操作的性能.(与 GFS1 相比体现在:单一目录负载,目录快速浏览,同步 I/O 操作,缓存读特性,日志功能的增强等等) 。3. 使用了虚拟化技术,减少了对硬件成本的投入,提高了现有资源的使用率。4. 使用了 Cluster 集群套件中的对在虚拟机环境下的 virtual service 支持技术,这样:4.1 当任何 domu 中的虚拟机宕机时,则可以由其他 domu 中的虚拟机接管服务,实现Failover. 比如:phyiscal1-virt1 出现宕机,physical1-virt1 上的服务会由 physical2-virt1 的虚拟机接管.

9、4.2 当任何物理机器 dom0 出现宕机时,这个机器上的 domu 的服务会由其他的物理机器上的 domu 虚拟机接管服务,实现 Failover. 比如: physica1 物理机出现宕机,physical1-virt1 上的服务会由 physical2 上的 physical2-virt1 虚拟机接管. 这样真正避免了单点故障,保证了无论是虚拟机还是物理机出现宕机,对外提供的服务 不会间断. - 6 -基于红帽企业版 Linux RHEL5U2 的 GFS2ISCSI虚拟化Cluster 的高可用性解决方案 史应生在本方案中我们通过上面的物理环境,将搭建两个集群环境:1. 由 physi

10、cal1 和 physical2 组成 dom0-cluster 集群.2. 由 physical1-virt1 和 physical2-virt2 组成 apache-clueter 集群.下面是根据网络结构,定义的主机表信息,即/etc/hosts: 127.0.0.1 localhost.localdomain localhost192.168.100.100 iscsitarget 192.168.100.102 192.168.100.103 physical1 physical2 192.168.100.203 physical1- physical1-virt1 192.1

11、68.100.204 physical2- physical2-virt1 - 7 -基于红帽企业版 Linux RHEL5U2 的 GFS2ISCSI虚拟化Cluster 的高可用性解决方案 史应生第二章 物理机系统安装和配置2.1 安装和配置 iscsitarget 机器操作系统:RHEL5U2AP 版本 下面是 iscsitarget 的 kickstart 配置文件:installnfs -server=10.66.0.76 -dir=/home/rhiso/ key 4c10c9d64c6b34c9 lang en_US.UTF-8 keyboard us xconfig -star

12、txonbootnetwork -device eth0 -bootproto static -ip 192.168.100.100 -hostname -netmask255.255.255.0 -gateway 192.168.100.254 -nameserver 192.168.100.254 rootpw -iscrypted $1$d1TMFbjq$DycVMZCP8bFM43hpW.FzI. firewall -disabledauthconfig -enableshadow -enablemd5selinux -disabled timezone Asia/Shanghaib

13、ootloader -location=mbr -driveorder=sda -append=“rhgb quiet“# The following is the partition information you requested# Note that any partitions you deleted are not expressed # here so unless you clear all partitions first, this is # not guaranteed to work clearpart -linux -drives=sda part / -fstype

14、 ext3 -size=20480part swap -size=2048%packagescluster-storage admin-tools editors virtualization gnome-desktop core base clustering base-xgraphical-internetscsi-target-utils kexec-tools bridge-utils device-mapper-multipath xorg-x11-utils xorg-x11-server-Xnestlibsane-hpaio-sysreport- 8 -基于红帽企业版 Linux

15、 RHEL5U2 的 GFS2ISCSI虚拟化Cluster 的高可用性解决方案 史应生2.2 配置 iscsitarget 服务端为本地硬盘增加三个分区/dev/sda5, /dev/sda6, /dev/sda7,作为 physical1 和 physical2 的共享存储盘。rootiscsitarget # fdisk -l Disk /dev/sda: 160.0 GB, 160041885696 bytes255 heads, 63 sectors/track, 19457 cylinders Units = cylinders of 16065 * 512 = 8225280 b

16、ytes Device Boot Start End Blocks Id System/dev/sda1 * 1 2611 20972826 83 Linux/dev/sda2 2612 2872 2096482+ 82 Linux swap / Solaris/dev/sda4 2873 19457 133219012+ 5 Extended/dev/sda5 2873 3967 8795556 83 Linux/dev/sda6 3968 5062 8795556 83 Linux/dev/sda7 5063 6157 8795556 83 Linux通过 tgt 服务把这三个分区共享出来

17、:rootiscsitarget # chkconfig tgtd onrootiscsitarget # chkconfig tgtd restart 使用 tgtadm 定义 iscsi target 的 qualified 名字:rootiscsitarget # tgtadm -lld iscsi -op new -mode target -tid 1 T iqn.2008-.sys.disk1 rootiscsitarget # tgtadm -lld iscsi -op new -mode target -tid 2 T iqn.2008-.sys.disk2 rootiscsit

18、arget # tgtadm -lld iscsi -op new -mode target -tid 3 T iqn.2008-.sys.disk3使用 tgtadm 为上一步创建的目标增加分区:rootiscsitarget # tgtadm -lld iscsi -op new -mode logicalunit -tid 1 -lun 1 -b /dev/sda5rootiscsitarget # tgtadm -lld iscsi -op new -mode logicalunit -tid 2 -lun 1 -b /dev/sda6rootiscsitarget # tgtadm

19、-lld iscsi -op new -mode logicalunit -tid 3 -lun 1 -b /dev/sda7使用 tgtadm 允许客户端访问这三个目标逻辑卷:rootiscsitarget # tgtadm -lld iscsi -op bind -mode target -tid 1 -I ALLrootiscsitarget # tgtadm -lld iscsi -op bind -mode target -tid 2 -I ALLrootiscsitarget # tgtadm -lld iscsi -op bind -mode target -tid 3 -I A

20、LL使用 tatadm 验证所有的目标逻辑卷定义正确:rootiscsitarget # tgtadm -lld iscsi -op show -mode target |grep Target Target 1: iqn.2008-.sys.disk1 Target 2: iqn.2008-.sys.disk2 Target 3: iqn.2008-.sys.disk3 为了使这个配置永远生效,把上述所有命令添加到/etc/rc.d/rc.local 文件中。- 9 -基于红帽企业版 Linux RHEL5U2 的 GFS2ISCSI虚拟化Cluster 的高可用性解决方案 史应生2.3 安

21、装 physical1 物理机操作系统:RHEL5U2AP 版本 下面是 physical1 的 kickstart 配置文件:installnfs -server=10.66.0.76 -dir=/home/rhiso/ key 4c10c9d64c6b34c9 lang en_US.UTF-8 keyboard us xconfig -startxonbootnetwork -device eth0 -bootproto static -ip 192.168.100.102 -hostname -netmask 255.255.255.0 -gateway 192.168.100.254

22、 -nameserver 192.168.100.254 rootpw -iscrypted $1$d1TMFbjq$DycVMZCP8bFM43hpW.FzI. firewall -disabledauthconfig -enableshadow -enablemd5selinux -disabled timezone Asia/Shanghaibootloader -location=mbr -driveorder=sda -append=“rhgb quiet“# The following is the partition information you requested# Note

23、 that any partitions you deleted are not expressed # here so unless you clear all partitions first, this is # not guaranteed to work clearpart -linux -drives=sda part / -fstype ext3 -size=20480part swap -size=2048%packagescluster-storage admin-tools editors virtualization gnome-desktop core base clu

24、stering base-xgraphical-internetscsi-target-utils kexec-tools bridge-utils device-mapper-multipath xorg-x11-utils xorg-x11-server-Xnestlibsane-hpaioiscsi-initiator-utils-sysreport- - 10基于红帽企业版 Linux RHEL5U2 的 GFS2ISCSI虚拟化Cluster 的高可用性解决方案 史应生2.4 配置 physical1 的 iscsi-initiator 客户端启动 iscsi 服务:rootphys

25、ical1 tmp# chkconfig iscsi onrootphysical1 tmp# service iscsi start 运行下面命令,discovery iscsitarget上的逻辑卷: rootphysical1 tmp# iscsiadm -m discovery -t sendtargets -p 192.168.100.100192.168.100.100:3260,1 iqn.2008-.disk1 192.168.100.100:3260,1 iqn.2008-.disk2 192.168.100.100:3260,1 iqn.2008-.disk3 说明 isc

26、sitarget 上共享的逻辑卷已经成功识别。使用 iscsiadm 登录 target:rootphysical1 tmp# iscsiadm -m node -T iqn.2008-.disk1 -p 192.168.100.100 -lrootphysical1 tmp# iscsiadm -m node -T iqn.2008-.disk2 -p 192.168.100.100 -lrootphysical1 tmp# iscsiadm -m node -T iqn.2008-.disk3 -p 192.168.100.100 -l使用fdisk检验被识别的设备名: rootphysi

27、cal1 tmp# fdisk -l Disk /dev/sda: 160.0 GB, 160000000000 bytes255 heads, 63 sectors/track, 19452 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System/dev/sda1 * 1 2611 20972826 83 Linux/dev/sda2 2612 2872 2096482+ 82 Linux swap / Solaris/dev/sda4 2873 194

28、52 133178850 5 Extended/dev/sda5 2873 2973 811251 83 LinuxDisk /dev/sdb: 9006 MB, 9006649344 bytes64 heads, 32 sectors/track, 8589 cylinders Units = cylinders of 2048 * 512 = 1048576 bytes Disk /dev/sdb doesnt contain a valid partition table Disk /dev/sdc: 9006 MB, 9006649344 bytes64 heads, 32 secto

29、rs/track, 8589 cylinders Units = cylinders of 2048 * 512 = 1048576 bytes Disk /dev/sdc doesnt contain a valid partition table Disk /dev/sdd: 9006 MB, 9006649344 bytes64 heads, 32 sectors/track, 8589 cylinders Units = cylinders of 2048 * 512 = 1048576 bytes Disk /dev/sdd doesnt contain a valid partit

30、ion table从 上 面 看 出 , iscsitarget 上 的 三 个 逻 辑 卷 , 分 别 被 识 别 成 了 本 地 磁 盘 /dev/sdb, /dev/sdc,/dev/sdd 三个本地磁盘。- 11 -基于红帽企业版 Linux RHEL5U2 的 GFS2ISCSI虚拟化Cluster 的高可用性解决方案 史应生在这三个磁盘上,分别建立一个分区,建立成功后的结果应为:rootphysical1 tmp# fdisk -lDisk /dev/sda: 160.0 GB, 160000000000 bytes255 heads, 63 sectors/track, 1945

31、2 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System/dev/sda1 * 1 2611 20972826 83 Linux/dev/sda2 2612 2872 2096482+ 82 Linux swap / Solaris/dev/sda4 2873 19452 133178850 5 Extended/dev/sda5 2873 2973 811251 83 LinuxDisk /dev/sdb: 9006 MB, 9006649344 by

32、tes64 heads, 32 sectors/track, 8589 cylinders Units = cylinders of 2048 * 512 = 1048576 bytes Device Boot Start End Blocks Id System/dev/sdb1 1 8589 8795120 83 LinuxDisk /dev/sdc: 9006 MB, 9006649344 bytes64 heads, 32 sectors/track, 8589 cylinders Units = cylinders of 2048 * 512 = 1048576 bytes Devi

33、ce Boot Start End Blocks Id System/dev/sdc1 1 8589 8795120 83 LinuxDisk /dev/sdd: 9006 MB, 9006649344 bytes64 heads, 32 sectors/track, 8589 cylinders Units = cylinders of 2048 * 512 = 1048576 bytes Device Boot Start End Blocks Id System/dev/sdd1 1 8589 8795120 83 Linux- - 12基于红帽企业版 Linux RHEL5U2 的 G

34、FS2ISCSI虚拟化Cluster 的高可用性解决方案 史应生2.5 安装 physical2 物理机操作系统:RHEL5U2AP 版本 下面是 physical2 的 kickstart 配置文件:installnfs -server=10.66.0.76 -dir=/home/rhiso/ key 4c10c9d64c6b34c9 lang en_US.UTF-8 keyboard us xconfig -startxonbootnetwork -device eth0 -bootproto static -ip 192.168.100.103 -hostname -netmask 2

35、55.255.255.0 -gateway 192.168.100.254 -nameserver 192.168.100.254 rootpw -iscrypted $1$d1TMFbjq$DycVMZCP8bFM43hpW.FzI. firewall -disabledauthconfig -enableshadow -enablemd5selinux -disabled timezone Asia/Shanghaibootloader -location=mbr -driveorder=sda -append=“rhgb quiet“# The following is the part

36、ition information you requested# Note that any partitions you deleted are not expressed # here so unless you clear all partitions first, this is# not guaranteed to work clearpart -linux -drives=sda part / -fstype ext3 -size=20480part swap -size=2048%packagescluster-storage admin-tools editors virtua

37、lization gnome-desktop core base clustering base-xgraphical-internetscsi-target-utils kexec-tools bridge-utils device-mapper-multipath xorg-x11-utils xorg-x11-server-Xnestlibsane-hpaioiscsi-initiator-utils-sysreport- - 13基于红帽企业版 Linux RHEL5U2 的 GFS2ISCSI虚拟化Cluster 的高可用性解决方案 史应生2.6 配置 physical2 的 isc

38、si-initiator 客户端启动 iscsi 服务:rootphysical2 tmp# chkconfig iscsi onrootphysical2 tmp# service iscsi start运行下面命令,discovery iscsitarget上的逻辑卷: rootphysical2 tmp# iscsiadm -m discovery -t sendtargets -p 192.168.100.100192.168.100.100:3260,1 iqn.2008-.disk1 192.168.100.100:3260,1 iqn.2008-.disk2 192.168.10

39、0.100:3260,1 iqn.2008-.disk3 说明 iscsitarget 上共享的逻辑卷已经成功识别。使用 iscsiadm登录target: rootphysical2 tmp# iscsiadm -m node -T iqn.2008-.disk1 -p 192.168.100.100 -lrootphysical2 tmp# iscsiadm -m node -T iqn.2008-.disk2 -p 192.168.100.100 -lrootphysical2 tmp# iscsiadm -m node -T iqn.2008-.disk3 -p 192.168.100

40、.100 -l使用fdisk扫描被识别的设备名和分区:rootphysical2 # fdisk -lDisk /dev/sda: 40.0 GB, 40000000000 bytes 255 heads, 63 sectors/track, 4863 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System/dev/sda1 * 1 2611 20972826 83 Linux/dev/sda2 2612 2872 2096482+ 82 Linux swa

41、p / SolarisDisk /dev/sdb: 9006 MB, 9006649344 bytes64 heads, 32 sectors/track, 8589 cylinders Units = cylinders of 2048 * 512 = 1048576 bytes Device Boot Start End Blocks Id System/dev/sdb1 1 8589 8795120 83 LinuxDisk /dev/sdc: 9006 MB, 9006649344 bytes64 heads, 32 sectors/track, 8589 cylinders Unit

42、s = cylinders of 2048 * 512 = 1048576 bytes Device Boot Start End Blocks Id System/dev/sdc1 1 8589 8795120 83 LinuxDisk /dev/sdd: 9006 MB, 9006649344 bytes64 heads, 32 sectors/track, 8589 cylinders Units = cylinders of 2048 * 512 = 1048576 bytes Device Boot Start End Blocks Id System/dev/sdd1 1 8589

43、 8795120 83 Linux- - 14基于红帽企业版 Linux RHEL5U2 的 GFS2ISCSI虚拟化Cluster 的高可用性解决方案 史应生2.7 配置 physical1 和 physical2 支持 clvm在 physical1 和 physical2 上分别 enable 基于集群的 lvm-clvm: lvmconf enable-cluster chkconfig clvmd on service clvmd start- - 15基于红帽企业版 Linux RHEL5U2 的 GFS2ISCSI虚拟化Cluster 的高可用性解决方案 史应生第三章 配置 do

44、m0-cluster3.1 在 iscsitarget 机器上配置 luci初始化 luci: rootiscsitarget # luci_admin initInitializing the luci serverCreating the admin userEnter password: Confirm password: Please wait. The admin password has been successfully set. Generating SSL certificates. The luci server has been successfully initiali

45、zedYou must restart the luci server for changes to take effect. Run “service luci restart“ to do so rootiscsitarget Server# chkconfig luci on rootiscsitarget Server# service luci restart Shutting down luci: OK Starting luci: Generating https SSL certificates. done OK Point your web browser to https:

46、/:8084 to access luci登陆 luci,如图 3.1。 - - 16基于红帽企业版 Linux RHEL5U2 的 GFS2ISCSI虚拟化Cluster 的高可用性解决方案 史应生图 3.1 3.2 创建 dom0-cluster 基本框架点击 cluster-create a New Cluster, 输入下面的信息:Cluster Name:dom0-clusterNode Hostname: - - 17基于红帽企业版 Linux RHEL5U2 的 GFS2ISCSI虚拟化Cluster 的高可用性解决方案 史应生图 3.2 然后点击 submit 按钮,如图 3.2。- - 18基于红帽企业版 Linux RHEL5U2 的 GF

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 实用文档 > 解决方案

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报