##########################################################################################
Pacemaker介绍:
##########################################################################################
corosync 是HA集群组件的一部分,专门负责消息的传递,它在传递信息的时候可以通过一个简单的配置文件来定义信息传递的方式和协议等。
pacemaker 是一个集群资源管理器,干的就是我们常说的CRM的活,它可以定义资源的组和次序。
corosync+pacemaker pacemaker负责心跳,corosync传递消息,两者合并组成一个完整的HA集群
Corosync是集群管理套件的一部分,它在传递信息的时候可以通过一个简单的配置文件来定义信息传递的方式和协议等。
Pacemaker是一个集群资源管理者。他用资源级别的监测和恢复来保证集群服务(aka.资源)的较大可用性。它可以用你所擅长的基础组件(Corosync或者是Heartbeat)来实现通信和关系管理
#####注意:配置了fence的时候,我们看到的现象是资源会回切(不一定),因为默认fence和配置资源的主机在不同的机器上
crmsh:命令行管理工具
crm
crm(live)# help
This is crm shell, a Pacemaker command line interface.
Available commands:
cib manage shadow CIBs
resource resources management
configure CRM cluster configuration
node nodes management
options user preferences
history CRM cluster history
site Geo-cluster support
ra resource agents information center
status show cluster status
help,? show help (help topics for list of topics)
end,cd,up go back one level
quit,bye,exit exit the program
资源 资源管理
配置 CRM集群配置
节点的 节点管理
选择 用户首选项
历史 CRM集群历史
网站 Geo-cluster支持
ra 资源代理信息中心
状态 显示集群状态
帮助,? 显示帮助(帮助主题列出主题)
结束,cd, 上升到一个水平
放弃,再见,退出 退出程序
我们现在来学习怎么使用crm:
在crm里面有个configure命令,表示配置集群 有众多子命令 子命令叫做show,显示集群配置信息,这个信息是.xml格式的,只是show把他显示为文本格式 show xml(可看到xml格式的文本)
show:
node dd6.example.com #节点信息
node dd7.example.com
property $id=“cib-bootstrap-options” \ #全局属性
dc-version=“1.1.10-14.el6-368c726”
cluster-infrastructure=“classic openais (with plugin)”
expected-quorum-votes=“2”
crm(live)configure# property #可用的全局属性
batch-limit= node-health-yellow=
cluster-delay= pe-error-series-max=
cluster-recheck-interval= pe-input-series-max=
crmd-transition-delay= pe-warn-series-max=
dc-deadtime= placement-strategy=
default-action-timeout= remove-after-stop=
default-resource-stickiness= shutdown-escalation=
election-timeout= start-failure-is-fatal=
enable-acl= startup-fencing=
enable-startup-probes= stonith-action=
is-managed-default= stonith-enabled=
maintenance-mode= stonith-timeout=
migration-limit= stop-all-resources=
no-quorum-policy= stop-orphan-actions=
node-health-green= stop-orphan-resources=
node-health-red= symmetric-cluster=
node-health-strategy=
stonith-enabled= 是不是必须要启动stonith设备,默认是必须
crm(live)configure# property stonith-enabled= (敲两下回车)
stonith-enabled (boolean, [true]): #接受boolean值,默认是ture
Failed nodes are STONITH’d
我们要把它设定为false,如果不设定会怎么样呢,我们查看configure的子命令
verify verify the CIB with crm_verify (查看有无语法错误)
crm(live)configure# verify
error: unpack_resources: Resource start-up disabled since no STONITH resources have been defined
error: unpack_resources: Either configure some or disable STONITH with the stonith-enabled option
error: unpack_resources: NOTE: Clusters with shared data need STONITH to ensure data integrity
Errors found during check: config not valid
crm(生活)配置#验证
错误:unpack_resources:由于没有定义了STONITH资源,因此禁用了资源启动
错误:unpack_resources:要么使用启用了STONITH的选项配置一些或禁用STONITH
错误:unpack_resources:注意:共享数据的集群需要STONITH来确保数据的完整性
检查期间发现的错误:配置无效
property stonith-enabled=false
crm(live)configure# property stonith-enabled=false
crm(live)configure# verify #再次校验,发现没有报错
crm(live)configure#
#在没有stonish设备时,要更改默认值
所有操作得提交才能生效 commit
node:
crm(live)node# help
Node management and status commands.
Available commands:
status show nodes' status as XML
show show node
standby put node into standby
online set node online
maintenance put node into maintenance mode
ready put node into ready mode
fence fence node
clearstate Clear node state
delete delete node
attribute manage attributes
utilization manage utilization attributes
status-attr manage status attributes
help show help (help topics for list of topics)
end go back one level
quit exit the program
crm(生活)节点#的帮助
节点管理和状态命令。
可用命令:
状态 显示节点作为XML的状态
显示 显示节点
备用 将节点放入备用状态
在线 设置节点在线
维护 节点进入维护模式
准备 将节点放入就绪模式
篱笆 栅栏节点
clearstate 明确节点状态
删除 删除节点
属性 管理属性
利用管理利用属性
status-attr 管理状态属性
帮助 显示帮助(帮助主题列表)
结束 回到一个层次
退出 退出程序
crm(live)node# show #显示所有节点信息
dd6.example.com: normal
dd7.example.com: normal
crm(live)node# standby #要想把一个节点设定为standby或和online,就在哪个节点上设定
crm(live)node# show
dd6.example.com: normal
dd7.example.com: normal
standby: on
crm(live)node# online
crm(live)node# show
dd6.example.com: normal
dd7.example.com: normal
standby: off
resource:
Available commands:
status show status of resources
start start a resource
stop stop a resource
restart