手机版
你好,游客 登录 注册
背景:
阅读新闻

Heartbeat3.x基本安装、配置与维护

[日期:2012-05-29] 来源:Linux社区  作者:flykite [字体:大 中 小]

    7. 利用Pacemaker简单监控后台进程。

  1. node $id="3b9aa356-2a55-42e5-98ca-de8c2596c200" node1.example.com 
  2. node $id="c136d120-72fc-4474-9eed-0469b3b050d0" node2.example.com 
  3. primitive ip-virtual-eth0 ocf:heartbeat:IPaddr2 \ 
  4.     params ip="10.11.203.17" cidr_netmask="22" \ 
  5.     op monitor interval="60" timeout="20" \ 
  6.     meta migration-threshold="3" 
  7. primitive ip-virtual-eth1 ocf:heartbeat:IPaddr2 \ 
  8.     params ip="10.13.203.17" cidr_netmask="22" \ 
  9.     op monitor interval="60" timeout="20" \ 
  10.     meta migration-threshold="3" 
  11. primitive svr-example1 ocf:heartbeat:anything \ 
  12.     params binfile="/usr/local/example1/example1" pidfile="/usr/local/example1/example1.pid" \ 
  13.     op monitor interval="30" timeout="20" \ 
  14.     meta migration-threshold="6" 
  15. primitive svr-example2 ocf:heartbeat:anything \ 
  16.     params binfile="/usr/local/example2/example2" pidfile="/usr/local/example2/example2.pid" \ 
  17.     op monitor interval="30" timeout="20" \ 
  18.     meta migration-threshold="6" 
  19. group ip-cluster ip-virtual-eth0 ip-virtual-eth1 \ 
  20.     meta target-role="Started" 
  21. group svr-cluster svr-example1 svr-example2 \ 
  22.     meta target-role="Started" 
  23. colocation ip-cluster_on_svr-cluster inf: ip-cluster svr-cluster 
  24. order ip-cluster_before_svr-cluster inf: ip-cluster svr-cluster 
  25. property $id="cib-bootstrap-options" \ 
  26.     dc-version="1.1.6-unknown" \ 
  27.     cluster-infrastructure="Heartbeat" \ 
  28.     stonith-enabled="false" \ 
  29.     no-quorum-policy="ignore" \ 
  30.     last-lrm-refresh="1332728605" 

     8. 最基本的维护与管理

    (1) 最简单的方式可以通过GUI界面进行管理

    (2) 常用的方式是通过命令行进行管理,我们可以通过官方文档资料了解。

    查看资源运行情况

  1. crm_resource -L
  2. or
  3. crm resource show

    当节点失败后,重置资源计数器

  1. crm_resource -C -H nod1.example.com -r svr-example1
  2. or
  3. crm resource failcount srv-example1 set node1.example.com 0
  4. crm resource cleanup srv-example1 set node1.example.com

    当节点不可用的时候,迁移资源至另外一个节点

  1. crm resource migrate ip-cluster node2.example.com 

    节点的常见操作:

  1. 删除节点: crm node delete <node> 
  2. 停用节点: crm node standby [<node>], 默认停用操作命令所在的节点 
  3. 启动节点: crm node online [<node>] 
  4. 设置/删除节点的attribute: crm node attribute <node> set <attr> <value> 
  5.                         crm node attribute <node> delete <attr> 

    资源的常见操作:

  1. 显示资源状态: crm resource status [<src>] 
  2. 启用/停用资源: crm resource start/stop <src> 
  3. 重启资源: crm resource restart <src> 
  4. 手动迁移资源: crm resource migrate (move) <rsc> [<node>] 
  5. 设置/删除资源的property:  crm resource param <rsc> set <param> <value> 
  6.                         crm resource param <rsc> delete <param> 
  7. 设置/删除资源的attribute: crm resource meta <rsc> set <attr> <value> 
  8.                         crm resource meta <rsc> delete <attr> 

    当然,关于Pacemaker的使用方法还有很多,并且CRM命令也有一定的复杂度,掌握常用的就可以了,对于一些不常用的就可查看相关资料,下载地址:

免费下载地址在 http://linux.linuxidc.com/

用户名与密码都是www.linuxidc.com

具体下载目录在 /2012年资料/5月/29日/Heartbeat3.x基本安装、配置与维护/

linux
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款