RHCA-436-4 rhcs conga
RHCS 是用来提供“高可用”集群的解决方案,目前功能完善,机制健全,是业界认可度比较不错的高可用解决方案。
RHCS包含组件:
corosync udp/5404
cman udp/5405
ricci tcp/11111
dlm tcp/21064
modclusterd tcp/16861
RHCS提供了多种管理工具来创建和维护集群,这里主要谈谈conga和ccs。用几个示例来综合谈谈rhcs。
示例一:2节点集群(xfs+nginx+lvm-ha)+仲裁盘qdisk
集群环境概述:3台kvm虚拟机(node1和node2跑应用,node3作存储),每台4块网卡(2块网卡eth3,eth4连存储,1块eth2心跳,1块eth1和物理机通信安装软件之用),操作系统都采用CentOS6.5 x64
1.准备环境
实验情况暂不考虑iptables和selinux,所以在每个节点上permissive selinux及清空iptables,再关闭可能对集群产生干扰及故障的不必要的服务,并修改集群节点的hosts表。
/etc/init.d/iptables stop
iptables-save >/etc/sysconfig/iptables
sed -i 's/SELINUX=enforcing/SELINUX=permissive/g'
/etc/sysconfig/selinux
chkconfig kdump off
chkconfig NetworkManager off
node1 #nginx服务节点
eth1 192.168.8.101
eth2 192.168.7.101
eth3 192.168.6.101
eth4 192.168.5.101
/etc/hosts
127.0.0.1 localhost
localhost.localdomain localhost4 localhost4.localdomain4
::1
localhost localhost.localdomain localhost6
localhost6.localdomain6
192.168.8.101 node1
192.168.7.101 node1
192.168.6.101 node1
192.168.5.101 node1
192.168.7.102 node2
192.168.7.103 luci
192.168.6.103 storage
192.168.5.103 storage
node2 #nginx服务节点
eth1 192.168.8.102
eth2 192.168.7.102
eth3 192.168.6.102
eth4 192.168.5.102
/etc/hosts
127.0.0.1 localhost
localhost.localdomain localhost4 localhost4.localdomain4
::1
localhost localhost.localdomain localhost6
localhost6.localdomain6
192.168.8.102 node2
192.168.7.102 node2
192.168.6.102 node2
192.168.5.102 node2
192.168.7.101 node1
192.168.7.103 luci
192.168.6.103 storage
192.168.5.103 storage
node3 #iSCSI存储及luci管理节点
eth1 192.168.8.103
eth2 192.168.7.103
eth3 192.168.6.103
eth4 192.168.5.103
/etc/hosts
127.0.0.1 localhost
localhost.localdomain localhost4 localhost4.localdomain4
::1
localhost localhost.localdomain localhost6
localhost6.localdomain6
192.168.8.103 storage
192.168.7.103 storage
192.168.6.103 storage
192.168.5.103 storage
192.168.6.101 node1
192.168.5.101 node1
192.168.6.102 node2
192.168.5.102 node2
192.168.7.103 luci
2.配置iSCSI存储,请参阅
RHCA-436-1 iSCSI
RHCA-436-3 multipath
3.部署conga
分别在node1,node2上安装ricci, 在node3上安装luci
yum -y install ricci
echo root|passwd --std ricci
/etc/init.d/ricci start
chkconfig ricci on
yum -y install luci
echo root|passwd --stdin luci
/etc/init.d/luci start
4.通过luci建立nginx ha集群
一.登录luci管理控制台
在浏览器中输入luci所在主机的ip,在luci启动时会给予提示。
https://192.168.7.103:8084
![RHCA-436-4 <wbr>rhcs <wbr>conga RHCA-436-4 <wbr>rhcs <wbr>conga](http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif)
添加例外,直接信任。
![RHCA-436-4 <wbr>rhcs <wbr>conga RHCA-436-4 <wbr>rhcs <wbr>conga](http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif)
初始用户为root,登录进去后会看到一个Warning, 直接忽略。最好添加一个普通账号来管理,我这里以luci来管理。加完账号赋予权限后,logout 再用luci这个用户登录。
![RHCA-436-4 <wbr>rhcs <wbr>conga RHCA-436-4 <wbr>rhcs <wbr>conga](http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif)
![RHCA-436-4 <wbr>rhcs <wbr>conga RHCA-436-4 <wbr>rhcs <wbr>conga](http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif)
![RHCA-436-4 <wbr>rhcs <wbr>conga RHCA-436-4 <wbr>rhcs <wbr>conga](http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif)
二. 创建集群
![RHCA-436-4 <wbr>rhcs <wbr>conga RHCA-436-4 <wbr>rhcs <wbr>conga](http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif)
![RHCA-436-4 <wbr>rhcs <wbr>conga RHCA-436-4 <wbr>rhcs <wbr>conga](http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif)
![RHCA-436-4 <wbr>rhcs <wbr>conga RHCA-436-4 <wbr>rhcs <wbr>conga](http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif)
集群名字,随便取,点完“Create cluster"之后会在后台为所有加入到该集群的节点安装相关软件包,装完后会重启集群节点。成功后如下图:
![RHCA-436-4 <wbr>rhcs <wbr>conga RHCA-436-4 <wbr>rhcs <wbr>conga](http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif)
在没有添加集群服务之前,我们通过clustat 可以看到以下状态。
Cluster Status for rhcs @ Sun Sep 28 14:32:02 2014
Member Status: Quorate
Member
Name
ID Status
------
----
---- ------
node1
1 Online, Local
node2
2 Online
基础设施
包括服务安装,集群集逻辑卷等。待基础设施做好后即可添加相关集群资源及集群服务了。
A.安装nginx,请参看Nginx-1.x.x源码自动安装配置(CentOS6)
B.lvm-ha
1.在所有服务节点上开启lvm cluster功能,并重启clvmd
lvmconf --enable-cluster
/etc/init.d/clvmd restart
[root@node1 ~]# grep locking_type /etc/lvm/lvm.conf
locking_type = 3
# NB. This
option only affects locking_type = 1 viz. local file-based
# The
external locking library to load if locking_type is set to 2.
chkconfig clvmd on
chkconfig rgmanager on
chkconfig cman on
2.分区,我这里分了1个2G的空间,用来建立集群级逻辑卷
[root@node1 ~]# parted /dev/mapper/redhat mklabel gpt
Information: You may need to update /etc/fstab.
[root@node1 ~]# parted /dev/mapper/redhat mkpart primary 1 2048
Information: You may need to update /etc/fstab.
[root@node1 ~]# partprobe /dev/mapper/redhat
WARNING: GPT (GUID Partition Table) detected on '/dev/mapper/redhat'! The util fdisk doesn't support GPT. Use GNU Parted.
Disk /dev/mapper/redhat: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Device
Boot
Start
RHCS包含组件:
corosync udp/5404
cman udp/5405
ricci tcp/11111
dlm tcp/21064
modclusterd tcp/16861
RHCS提供了多种管理工具来创建和维护集群,这里主要谈谈conga和ccs。用几个示例来综合谈谈rhcs。
示例一:2节点集群(xfs+nginx+lvm-ha)+仲裁盘qdisk
集群环境概述:3台kvm虚拟机(node1和node2跑应用,node3作存储),每台4块网卡(2块网卡eth3,eth4连存储,1块eth2心跳,1块eth1和物理机通信安装软件之用),操作系统都采用CentOS6.5 x64
1.准备环境
实验情况暂不考虑iptables和selinux,所以在每个节点上permissive selinux及清空iptables,再关闭可能对集群产生干扰及故障的不必要的服务,并修改集群节点的hosts表。
/etc/init.d/iptables stop
iptables-save >/etc/sysconfig/iptables
sed -i 's/SELINUX=enforcing/SELINUX=permissive/g'
chkconfig kdump off
chkconfig NetworkManager off
node1
eth1 192.168.8.101
eth2 192.168.7.101
eth3 192.168.6.101
eth4 192.168.5.101
/etc/hosts
127.0.0.1
::1
192.168.8.101 node1
192.168.7.101 node1
192.168.6.101 node1
192.168.5.101 node1
192.168.7.102 node2
192.168.7.103 luci
192.168.6.103 storage
192.168.5.103 storage
node2
eth1 192.168.8.102
eth2 192.168.7.102
eth3 192.168.6.102
eth4 192.168.5.102
/etc/hosts
127.0.0.1
::1
192.168.8.102 node2
192.168.7.102 node2
192.168.6.102 node2
192.168.5.102 node2
192.168.7.101 node1
192.168.7.103 luci
192.168.6.103 storage
192.168.5.103 storage
node3
eth1 192.168.8.103
eth2 192.168.7.103
eth3 192.168.6.103
eth4 192.168.5.103
/etc/hosts
127.0.0.1
::1
192.168.8.103 storage
192.168.7.103 storage
192.168.6.103 storage
192.168.5.103 storage
192.168.6.101 node1
192.168.5.101 node1
192.168.6.102 node2
192.168.5.102 node2
192.168.7.103 luci
2.配置iSCSI存储,请参阅
RHCA-436-1 iSCSI
RHCA-436-3 multipath
3.部署conga
分别在node1,node2上安装ricci, 在node3上安装luci
yum -y install ricci
echo root|passwd --std ricci
/etc/init.d/ricci start
chkconfig ricci on
yum -y install luci
echo root|passwd --stdin luci
/etc/init.d/luci start
4.通过luci建立nginx ha集群
一.登录luci管理控制台
在浏览器中输入luci所在主机的ip,在luci启动时会给予提示。
https://192.168.7.103:8084
![RHCA-436-4 <wbr>rhcs <wbr>conga RHCA-436-4 <wbr>rhcs <wbr>conga](http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif)
添加例外,直接信任。
![RHCA-436-4 <wbr>rhcs <wbr>conga RHCA-436-4 <wbr>rhcs <wbr>conga](http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif)
初始用户为root,登录进去后会看到一个Warning, 直接忽略。最好添加一个普通账号来管理,我这里以luci来管理。加完账号赋予权限后,logout 再用luci这个用户登录。
![RHCA-436-4 <wbr>rhcs <wbr>conga RHCA-436-4 <wbr>rhcs <wbr>conga](http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif)
![RHCA-436-4 <wbr>rhcs <wbr>conga RHCA-436-4 <wbr>rhcs <wbr>conga](http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif)
![RHCA-436-4 <wbr>rhcs <wbr>conga RHCA-436-4 <wbr>rhcs <wbr>conga](http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif)
二. 创建集群
![RHCA-436-4 <wbr>rhcs <wbr>conga RHCA-436-4 <wbr>rhcs <wbr>conga](http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif)
![RHCA-436-4 <wbr>rhcs <wbr>conga RHCA-436-4 <wbr>rhcs <wbr>conga](http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif)
![RHCA-436-4 <wbr>rhcs <wbr>conga RHCA-436-4 <wbr>rhcs <wbr>conga](http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif)
集群名字,随便取,点完“Create cluster"之后会在后台为所有加入到该集群的节点安装相关软件包,装完后会重启集群节点。成功后如下图:
![RHCA-436-4 <wbr>rhcs <wbr>conga RHCA-436-4 <wbr>rhcs <wbr>conga](http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif)
在没有添加集群服务之前,我们通过clustat 可以看到以下状态。
Cluster Status for rhcs @ Sun Sep 28 14:32:02 2014
Member Status: Quorate
基础设施
包括服务安装,集群集逻辑卷等。待基础设施做好后即可添加相关集群资源及集群服务了。
A.安装nginx,请参看Nginx-1.x.x源码自动安装配置(CentOS6)
B.lvm-ha
1.在所有服务节点上开启lvm cluster功能,并重启clvmd
lvmconf --enable-cluster
/etc/init.d/clvmd restart
[root@node1 ~]# grep locking_type /etc/lvm/lvm.conf
chkconfig clvmd on
chkconfig rgmanager on
chkconfig cman on
2.分区,我这里分了1个2G的空间,用来建立集群级逻辑卷
[root@node1 ~]# parted /dev/mapper/redhat mklabel gpt
Information: You may need to update /etc/fstab.
[root@node1 ~]# parted /dev/mapper/redhat mkpart primary 1 2048
Information: You may need to update /etc/fstab.
[root@node1 ~]# partprobe /dev/mapper/redhat
WARNING: GPT (GUID Partition Table) detected on '/dev/mapper/redhat'! The util fdisk doesn't support GPT. Use GNU Parted.
Disk /dev/mapper/redhat: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000