1、拓扑
主机名 主机用途 IP地址 虚拟IP(VIP)
FreeNAS ISCSI Server 172.16.1.200 无
Server.shbztech.com RHCS Server 172.16.1.50 无
web1.shbzztech.com RHCS Node1 172.16.1.41 172.16.1.45
Web2.shbzztech.com RHCS Node2 172.16.1.42 172.16.1.45
2、系统基本配置:(每个节点)
selinux firewall Hostname IP地址 GATEWAY DNS hosts yum仓库等。
A、Hosts文件(每个节点)
172.16.1.41 web1.shbztech.com web1
172.16.1.42 web2.shbztech.com web2
172.16.1.50 Server.shbztech.com Server
B、#yum仓库 (每个节点)
/etc/yum.repos.d/server.repo
[base]
name=base
baseurl=file:///mnt/iso
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[HighAvailability]
name=HighAvailability
baseurl=file:///mnt/iso/HighAvailability
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[LoadBalancer]
name=LoadBalancer
baseurl=file:///mnt/iso/LoadBalancer
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[ResilientStorage]
name=ResilientStorage
baseurl=file:///mnt/iso/ResilientStorage
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
C、关闭NetworkManager服务(必须关闭,否则集群加node会报错)(每个节点)
chkconfig NetworkManager off
service NetworkManager stop
D、安装软件包(每个节点)
#install cman
rpm -ivh perl-XML-NamespaceSupport-1.10-3.el6.noarch.rpm
rpm -ivh perl-XML-SAX-0.96-7.el6.noarch.rpm
rpm -ivh perl-XML-LibXML-1.70-5.el6.x86_64.rpm
rpm -ivh perl-Net-Telnet-3.03-11.el6.noarch.rpm
rpm -ivh pexpect-2.3-6.el6.noarch.rpm
rpm -ivh openais-1.1.1-7.el6.x86_64.rpm
rpm -ivh cman-3.0.12.1-32.el6.x86_64.rpm
#install ricci
rpm -ivh modcluster-0.16.2-18.el6.x86_64.rpm
rpm -ivh ricci-0.16.2-55.el6.x86_64.rpm
#install gfs2
rpm -ivh gfs2-utils-3.0.12.1-32.el6.x86_64.rpm
#install rgmanager
rpm -ivh rgmanager-3.0.12.1-12.el6.x86_64.rpm
#install clvmd
rpm -ivh lvm2-cluster-2.02.95-10.el6.x86_64.rpm
#install iscsi
rpm -ivh iscsi-initiator-utils.x86_64 0:6.2.0.872-41.el6
两节点上安装(Cman ricci gfs2 rgmanager clvmd iscsi)
Cman
yum -y install perl-XML-NamespaceSupport perl-XML-SAX perl-XML-LibXML perl-Net-Telnet pexpect openais cman
ricci gfs2 rgmanager clvmd
yum -y install modcluster ricci gfs2-utils rgmanager lvm2-cluster
iscsi
yum -y install iscsi-initiator-utils
RHCS管理服务器上安装(luci)
luci
yum -y install luci
E、集群服务配置(每个节点)
更改个节点ricci用户密码
passwd ricci
chkconfig ricci on
chkconfig rgmanager on
chkconfig cman on
service ricci start
service rgmanager start
service cman start(FAILED)
集群服务配置(Server)
chkconfig luci on
service luci start
F、ISCSI客户端配置(每个节点)
yum -y install iscsi*
iscsiadm -m discovery -t sendtargets -p 172.16.1.200
service iscsi start
fdisk -l
3、RHCS集群配置(Conga)
https://172.16.1.50:8084
用户名root密码xiaodong
A、创建集群“Mycluster”
Manage Clusters --> Create
Cluster Name "Mycluster"
NodeName Password RicciHostname Ricci Port
web1.shbztech.com xiaodong web1.shbztech.com 11111
web2.shbztech.com xiaodong web2.shbztech.com 11111
Use Locally Installed Packages
B、Fence Devices配置
VMware Fencing(SOAP Interface)
Name“Esxi_Fence”
IP Address or Hostname“172.16.1.11”(Esxi IP地址)
Login“root”
Password“esxilogin”
C、Failover Domains配置
Name“Web_Failover”
Prioritized
Restricted
web1.shbztech.com5 (主)
web2.shbztech.com10(备)
D、Resources配置
IP Address
IP Address“172.16.1.45”
Netmask Bits(optional)“24”
Monitor Link
Script
Name“Httpd_Script”
Full Path to Script File“/etc/init.d/httpd”
E、Service Group配置
Service Name“WebServer”
AutoMatically Start This Service
Failover Domain“Web_Failover”
Recovery Policy“Relocate”
Add Resource“Httpd_Script”
Add Resource“172.16.1.45/24”
F、Node绑定Fence设备
Node1:web1.shbztech.com
Nodes --> web1.shbztech.com --> Add Fence Method
Method Name“fence_s1”
Add Fence Instance --> Esxi_Fence(VMware Fencing(SOAP Interface))
VM name“web1-172.16.1.41”(节点1在vsphere中的名称)
VM UUID“56 4d 99 1e ea 70 ff 8b-17 e3 1b 8d c6 5a 0a 62” (虚拟机文件中‘web1-172.16.1.41.vmx’的‘uuid.location’)
Node2:web2.shbztech.com
Nodes --> web2.shbztech.com --> Add Fence Method
Method Name“fence_s2”
Add Fence Instance --> Esxi_Fence(VMware Fencing(SOAP Interface))
VM name“web2-172.16.1.42”(节点1在vsphere中的名称)
VM UUID“56 4d 11 b0 b4 85 3c 15-10 b9 eb 18 80 03 11 a0” (虚拟机文件中‘web1-172.16.1.41.vmx’的‘uuid.location’)
G、CLVM的配置(每个节点)
磁盘分区(一个节点)
fdisk /dev/sdb
/dev/sdb5 1G
/dev/sdb6 80G
CLVM配置(每个节点)
chkconfig clvmd on
lvmconf --enable-cluster
grep "locking_type = 3" /etc/lvm/lvm.conf (371行)
/etc/init.d/clvmd start
创建LV磁盘(一个节点)
pvcreate /dev/sdb6
vgcreate vg_iscsi /dev/sdb6
reboot(每个节点)
lvcreate -L 30G -n lv_webdata vg_iscsi
H、QDisk配置(每个节点)
Manage Clusters --> Mycluster --> Configure --> QDisk
Use a Quorum Disk
By Filesystem Path to Device(deprecated)
“/dev/sdb7”
Path to Program Interval Score TKO
ping -c3 -t2 172.16.1.1 3 2 10
Minimum Total Score 1
mkqdisk -c /dev/sdb7 -l myqdisk
mkqdisk -L
reboot
I、GFS配置(一个节点)
mkfs.gfs2 -p lock_dlm -t Mycluster:my-gfs2 -j 4 /dev/vg_iscsi/lv_webdata
J、GFS文件系统挂载(每个节点)
tail -1 /etc/fstab
/dev/vg_iscsi/lv_webdata /webdata gfs2 defaults 0 0
mkdir /webdata
4、Apache服务配置(每个节点)
tail -10 /etc/httpd/conf/httpd.conf
NameVirtualHost 172.16.1.41:80
<VirtualHost 172.16.1.45:80>
ServerAdmin xiaodong@shbztech.com
DocumentRoot /webdata/www.shbztech.com
ServerName www.shbztech.com
ErrorLog logs/www.shbztech.com-error_log
CustomLog logs/www.shbztech.com-access_log common
</VirtualHost>
mkdir /webdata/www.shbztech.com
编写静态页面代码
vim /webdata/www.shbztech.com/index.html
<html><head> <title>流动字体</title> </head>
<body text=#ff0000 bgcolor=#ccff99>
<marquee direction =right behavior=scroll > <font size="6">东东小窝</font>
</marquee > <P>
</marquee > <P>
<marquee direction=left > <font size="6">http://xiaoxiaodong.blog.51cto.com</font>
</marquee > <p>
</marquee > <P>
<marquee direction =right behavior=scroll><font size="6">http://xiaoxiaodong.blog.51cto.com</font>
</marquee > <p>
</marquee > <P>
<marquee direction=left > <font size="6">http://xiaoxiaodong.blog.51cto.com</font>
</marquee > <p>
</marquee > <P>
<marquee direction =right behavior=scroll><font size="6">http://xiaoxiaodong.blog.51cto.com</font>
</marquee > <p>
</marquee > <P>
<marquee direction=left > <font size="6">http://xiaoxiaodong.blog.51cto.com</font>
</marquee > <p>
</marquee > <P>
<marquee direction =right behavior=scroll><font size="6">http://xiaoxiaodong.blog.51cto.com</font>
</marquee > <p>
</marquee > <P>
<marquee direction=left > <font size="6">http://xiaoxiaodong.blog.51cto.com</font>
</marquee > <p>
</marquee > <P>
<marquee direction =right behavior=scroll><font size="6">http://xiaoxiaodong.blog.51cto.com</font>
</marquee > <p>
</marquee > <P>
<marquee direction=left > <font size="6">http://xiaoxiaodong.blog.51cto.com</font>
</marquee > <p>
</marquee > <P>
<marquee direction =right behavior=scroll><font size="6">http://xiaoxiaodong.blog.51cto.com</font>
</marquee > <p>
</marquee > <P>
</body> </html>
5、测试Apache服务
http://172.16.1.45