whx00 2014-07-28
说明:由于配置节点比较多,有些操作使用简单的ansible部署,同时为了能清淅明白操作步骤没有写成playbook;
拓扑图:
1、确保所有节点时间同步;
[root@ansible ~]# ansible group1 -a 'date'
server13.neo.com | success | rc=0 >>
Sat Jul 26 10:31:49 CST 2014
server11.neo.com | success | rc=0 >>
Sat Jul 26 10:31:50 CST 2014
server12.neo.com | success | rc=0 >>
Sat Jul 26 10:31:50 CST 2014
2、确保NetworkManager己关闭;
[root@ansible ~]# ansible group1 -a 'chkconfig --list NetworkManager'
server11.neo.com | success | rc=0 >>
NetworkManager 0:off 1:off 2:off 3:off 4:off 5:off 6:off
server13.neo.com | success | rc=0 >>
NetworkManager 0:off 1:off 2:off 3:off 4:off 5:off 6:off
server12.neo.com | success | rc=0 >>
NetworkManager 0:off 1:off 2:off 3:off 4:off 5:off 6:off
一、RHCS高可用部署
1、RHCS管理节点安装luci组件
[root@ansible ~]# yum install -y luci --disablerepo=epel
[root@ansible ~]# service luci start
[root@ansible ~]# netstat -tunlp |grep 8084
2、RHCS集群节点安装ricci组件
[root@ansible ~]# ansible group1 -m yum -a 'name=ricci state=present disablerepo=epel'
[root@ansible ~]# ansible group1 -m service -a 'name=ricci state=started enabled=yes'
[root@ansible ~]# ansible group1 -m shell -a 'netstat -tunlp |grep ricci'
3、为每个RHCS集群节点添加web服务且提供主页文件
[root@ansible ~]# ansible group1 -m yum -a 'name=httpd state=present'
[root@ansible ~]# ansible group1 -m shell -a 'echo "<h1>`uname -n`</h1>" >/var/www/html/index.html'
[root@ansible ~]# ansible group1 -m service -a 'name=httpd state=started enabled=yes'
[root@ansible ~]# ansible group1 -m shell -a 'echo asdasd |passwd --stdin ricci'
4、使用web GUI界面配置高可用服务
1)在浏览器中访问https://192.168.100.200:8084;
2)使用root帐号密码登陆;
3)创建集群服务
注意Node Name中的Password是我们为ricci添加的密码;
4)定义故障域"FailOver Domains",且定义“Priority”值;
5)添加资源“Resources”,这里lsb风格的服务需指定为Scripts;添加VIP与Httpd两个资源;
6)定义组“Group”,把VIP与httpd添加进组中;
7)启动组;
8)模拟故障,在web GUI界面切换组资源在节点上的运行;
我们也可以在shell命令行下查看节点状态:
[root@server11 ~]# clustat
Cluster Status for My_Cluster @ Sat Jul 26 11:28:36 2014
Member Status: Quorate
Member Name ID Status
------ ---- ---- ------
server11.neo.com 1 Online, Local, rgmanager
server12.neo.com 2 Online, rgmanager
server13.neo.com 3 Online, rgmanager
Service Name Owner (Last) State
------- ---- ----- ------ -----
service:webserver server13.neo.com started
至此一个简单的web高可用集群服务部署完成。
相关的命令行管理工具:
clusvcadm
cman_tool
ccs_tool
cman的配置文件在/etc/cluster/cluster.conf