定义web服务资源
在两个节点上都要进行安装
安装完毕后,可以查看httpd的lsb脚本
[root@www1 corosync]# crm ra list lsb
[root@www1 corosync]# crm
或者
crm(live)# ra
crm(live)ra# list lsb

crm(live)ra# end
crm(live)# configure
crm(live)configure# primitive webserver lsb:httpd
定义httpd的资源
crm(live)configure# show
node www1.gjp.com
node www2.gjp.com
primitive webip ocf:heartbeat:IPaddr \
params ip="192.168.2.66"
primitive webserver lsb:httpd
property $id="cib-bootstrap-options" \
dc-version="1.1.5-1.1.el5-01e86afaaa6d4a8c4836f68df80ababd6ca3902f" \
cluster-infrastructure="openais" \
expected-quorum-votes="2" \
stonith-enabled="false"
crm(live)configure# commit
crm(live)configure# end
crm(live)# status
============
Last updated: Thu Oct 25 16:06:46 2012
Stack: openais
Current DC: www1.gjp.com - partition with quorum
Version: 1.1.5-1.1.el5-01e86afaaa6d4a8c4836f68df80ababd6ca3902f
2 Nodes configured, 2 expected votes
2 Resources configured.
============
Online: [ www1.gjp.com www2.gjp.com ]
webip (ocf::heartbeat:IPaddr): Started www1.gjp.com
webserver (lsb:httpd): Started www1.gjp.com
Failed actions:
webserver_monitor_0 (node=www2.gjp.com, call=3, rc=5, status=complete): not installed
如果www2.gjp.com上面已安装http服务,则会出现,ip在www1上,服务在www2上运行!
[root@www1 ~]# service httpd status
httpd (pid 4897) is running...
[root@www1 ~]# echo "www1.gjp.com">/var/www/html/index.html
[root@www1 ~]# crm
crm(live)# configure
crm(live)configure# help group
The `group` command creates a group of resources.
Usage:
...............
group <name> <rsc> [<rsc>...]
[meta attr_list]
[params attr_list]
attr_list :: [$id=<id>] <attr>=<val> [<attr>=<val>...] | $id-ref=<id>
...............
Example:
...............
group internal_www disk0 fs0 internal_ip apache \
meta target_role=stopped
...............
crm(live)configure# group web webip webserver
crm(live)configure# commit

客户机测试:

[root@www1 ~]# crm status
============
Last updated: Thu Oct 25 16:34:28 2012
Stack: openais
Current DC: www1.gjp.com - partition with quorum
Version: 1.1.5-1.1.el5-01e86afaaa6d4a8c4836f68df80ababd6ca3902f
2 Nodes configured, 2 expected votes
1 Resources configured.
============
Online: [ www1.gjp.com www2.gjp.com ]
Resource Group: web
webip (ocf::heartbeat:IPaddr): Started www1.gjp.com
webserver (lsb:httpd): Started www1.gjp.com
Failed actions:
webserver_monitor_0 (node=www2.gjp.com, call=3, rc=5, status=complete): not installed
