Apr
9
[转]heartbeat CRM管理程序功能示例
heartbeat 2.x使用CRM进行集群资源和管理的工作,除了提供hb_gui图形管理工具外,还可以使用crm_resource程序进行管理。以下内容截取自:分享:heartbeat 2.x style的配置,供参考。
1)查看所有资源
crm_resource -L
2)查看资源跑在哪个节点上
crm_resource -W -r runhttpd.sh_2
resource runhttpd.sh_2 is running on: server1
crm_resource -W -r runhttpd.sh_2
resource runhttpd.sh_2 is NOT running
4)启动/停止资源
crm_resource -r runhttpd.sh_2 -p target_role -v started
crm_resource -r runhttpd.sh_2 -p target_role -v stopped
5)查看资源在cib.xml中的定义
crm_resource -x -r runhttpd.sh_2
6)将资源从当前节点移动向另个节点
crm_resource -M -r runhttpd.sh_2
7)将资源移向指定节点
crm_resource -M -r runhttpd.sh_2 -H c001n02
允许资源回到正常的节点
crm_resource -U -r runhttpd.sh_2
9)将资源从CRM中删除
crm_resource -D -r runhttpd.sh_2 -t primitive
10)将资源组从CRM中删除
crm_resource -D -r my_first_group -t group
11)将资源从CRM中禁用
crm_resource -p is_managed -r runhttpd.sh_2 -t primitive -v off
12)将资源从新从CRM中启用
crm_resource -p is_managed -r runhttpd.sh_2 -t primitive -v on
13)Resetting a failed resource after having been manually cleaned up
crm_resource -C -H c001n02 -r runhttpd.sh_2
14)检查所有节点上未在CRM中的资源
crm_resource -P
15)检查指定节点上未在CRM中的资源
crm_resource -P -H c001n02
You could query the email address using the following:
crm_resource -r example_mail -g email
16)设置资源的某个属性
crm_resource -r example_mail -p email -v "myemailaddress@somedomain.com"
1)查看所有资源
crm_resource -L
2)查看资源跑在哪个节点上
crm_resource -W -r runhttpd.sh_2
resource runhttpd.sh_2 is running on: server1
crm_resource -W -r runhttpd.sh_2
resource runhttpd.sh_2 is NOT running
4)启动/停止资源
crm_resource -r runhttpd.sh_2 -p target_role -v started
crm_resource -r runhttpd.sh_2 -p target_role -v stopped
5)查看资源在cib.xml中的定义
crm_resource -x -r runhttpd.sh_2
6)将资源从当前节点移动向另个节点
crm_resource -M -r runhttpd.sh_2
7)将资源移向指定节点
crm_resource -M -r runhttpd.sh_2 -H c001n02
允许资源回到正常的节点
crm_resource -U -r runhttpd.sh_2
引用
NOTE: the values of resource_stickiness and default_resource_stickiness may mean that it doesnt move back. In such cases, you should use -M to move it back and then run this command.
9)将资源从CRM中删除
crm_resource -D -r runhttpd.sh_2 -t primitive
10)将资源组从CRM中删除
crm_resource -D -r my_first_group -t group
11)将资源从CRM中禁用
crm_resource -p is_managed -r runhttpd.sh_2 -t primitive -v off
12)将资源从新从CRM中启用
crm_resource -p is_managed -r runhttpd.sh_2 -t primitive -v on
13)Resetting a failed resource after having been manually cleaned up
crm_resource -C -H c001n02 -r runhttpd.sh_2
14)检查所有节点上未在CRM中的资源
crm_resource -P
15)检查指定节点上未在CRM中的资源
crm_resource -P -H c001n02
引用
Querying a parameter of a resource. Say the resource is the following:
<primitive id="example_mail" class="ocf" type="MailTo" provider="heartbeat">
<instance_attributes id="example_mail_inst">
<attributes>
<nvpair id="example_mail_inst_attr0" name="email" value="root"/>
<nvpair id="example_mail_inst_attr1" name="subject" value="Example Failover"/>
</attributes>
</instance_attributes>
</primitive>
<primitive id="example_mail" class="ocf" type="MailTo" provider="heartbeat">
<instance_attributes id="example_mail_inst">
<attributes>
<nvpair id="example_mail_inst_attr0" name="email" value="root"/>
<nvpair id="example_mail_inst_attr1" name="subject" value="Example Failover"/>
</attributes>
</instance_attributes>
</primitive>
You could query the email address using the following:
crm_resource -r example_mail -g email
16)设置资源的某个属性
crm_resource -r example_mail -p email -v "myemailaddress@somedomain.com"