7. 利用Pacemaker简单监控后台进程。
- node $id="3b9aa356-2a55-42e5-98ca-de8c2596c200" node1.example.com
- node $id="c136d120-72fc-4474-9eed-0469b3b050d0" node2.example.com
- primitive ip-virtual-eth0 ocf:heartbeat:IPaddr2 \
- params ip="10.11.203.17" cidr_netmask="22" \
- op monitor interval="60" timeout="20" \
- meta migration-threshold="3"
- primitive ip-virtual-eth1 ocf:heartbeat:IPaddr2 \
- params ip="10.13.203.17" cidr_netmask="22" \
- op monitor interval="60" timeout="20" \
- meta migration-threshold="3"
- primitive svr-example1 ocf:heartbeat:anything \
- params binfile="/usr/local/example1/example1" pidfile="/usr/local/example1/example1.pid" \
- op monitor interval="30" timeout="20" \
- meta migration-threshold="6"
- primitive svr-example2 ocf:heartbeat:anything \
- params binfile="/usr/local/example2/example2" pidfile="/usr/local/example2/example2.pid" \
- op monitor interval="30" timeout="20" \
- meta migration-threshold="6"
- group ip-cluster ip-virtual-eth0 ip-virtual-eth1 \
- meta target-role="Started"
- group svr-cluster svr-example1 svr-example2 \
- meta target-role="Started"
- colocation ip-cluster_on_svr-cluster inf: ip-cluster svr-cluster
- order ip-cluster_before_svr-cluster inf: ip-cluster svr-cluster
- property $id="cib-bootstrap-options" \
- dc-version="1.1.6-unknown" \
- cluster-infrastructure="Heartbeat" \
- stonith-enabled="false" \
- no-quorum-policy="ignore" \
- last-lrm-refresh="1332728605"
8. 最基本的维护与管理
(1) 最简单的方式可以通过GUI界面进行管理

(2) 常用的方式是通过命令行进行管理,我们可以通过官方文档资料了解。
查看资源运行情况
- crm_resource -L
- or
- crm resource show
当节点失败后,重置资源计数器
- crm_resource -C -H nod1.example.com -r svr-example1
- or
- crm resource failcount srv-example1 set node1.example.com 0
- crm resource cleanup srv-example1 set node1.example.com
当节点不可用的时候,迁移资源至另外一个节点
- crm resource migrate ip-cluster node2.example.com
节点的常见操作:
- 删除节点: crm node delete <node>
- 停用节点: crm node standby [<node>], 默认停用操作命令所在的节点
- 启动节点: crm node online [<node>]
- 设置/删除节点的attribute: crm node attribute <node> set <attr> <value>
- crm node attribute <node> delete <attr>
资源的常见操作:
- 显示资源状态: crm resource status [<src>]
- 启用/停用资源: crm resource start/stop <src>
- 重启资源: crm resource restart <src>
- 手动迁移资源: crm resource migrate (move) <rsc> [<node>]
- 设置/删除资源的property: crm resource param <rsc> set <param> <value>
- crm resource param <rsc> delete <param>
- 设置/删除资源的attribute: crm resource meta <rsc> set <attr> <value>
- crm resource meta <rsc> delete <attr>
当然,关于Pacemaker的使用方法还有很多,并且CRM命令也有一定的复杂度,掌握常用的就可以了,对于一些不常用的就可查看相关资料,下载地址:
免费下载地址在 http://linux.linuxidc.com/
用户名与密码都是www.linuxidc.com
具体下载目录在 /2012年资料/5月/29日/Heartbeat3.x基本安装、配置与维护/
