Product SiteDocumentation Site

第 5 章 创建一个主/备集群

目录

5.1. 浏览现有配置
5.2. 添加一个资源
5.3. 做一次失效备援
5.3.1. 法定人数和双节点集群
5.3.2. 防止资源在节点恢复后移动

5.1. 浏览现有配置

当Pacemaker启动的时候,它会自动记录节点的数量和详细信息,以及基层软件(本文中是corosync)和Pacemaker的版本。
这是初始配置文件的模样:
# crm configure show
node pcmk-1
node pcmk-2
property $id="cib-bootstrap-options" \
    dc-version="1.1.5-bdd89e69ba545404d02445be1f3d72e6a203ba2f" \
    cluster-infrastructure="openais" \
    expected-quorum-votes="2"
For those that are not of afraid of XML, you can see the raw configuration by appending "xml" to the previous command.
这是本文档最后一次显示XML。(作者怨念很深啊)
# crm configure show xml
<?xml version="1.0" ?>
<cib admin_epoch="0" crm_feature_set="3.0.1" dc-uuid="pcmk-1" epoch="13" have-quorum="1" num_updates="7" validate-with="pacemaker-1.0">
 <configuration>
  <crm_config>
   <cluster_property_set id="cib-bootstrap-options">
    <nvpair id="cib-bootstrap-options-dc-version" name="dc-version" value="1.1.5-bdd89e69ba545404d02445be1f3d72e6a203ba2f"/>
    <nvpair id="cib-bootstrap-options-cluster-infrastructure" name="cluster-infrastructure" value="openais"/>
    <nvpair id="cib-bootstrap-options-expected-quorum-votes" name="expected-quorum-votes" value="2"/>
   </cluster_property_set>
  </crm_config>
  <rsc_defaults/>
  <op_defaults/>
  <nodes>
   <node id="pcmk-1" type="normal" uname="pcmk-1"/>
   <node id="pcmk-2" type="normal" uname="pcmk-2"/>
  </nodes>
  <resources/>
  <constraints/>
 </configuration>
</cib>
在我们做出任何改变之前,我们最好检查下配置文件。
# crm_verify -L
crm_verify[2195]: 2009/08/27_16:57:12 ERROR: unpack_resources: Resource start-up disabled since no STONITH resources have been defined
crm_verify[2195]: 2009/08/27_16:57:12 ERROR: unpack_resources: Either configure some or disable STONITH with the stonith-enabled option
crm_verify[2195]: 2009/08/27_16:57:12 ERROR: unpack_resources: NOTE: Clusters with shared data need STONITH to ensure data integrity
Errors found during check: config not valid -V may provide more details
#
就像你看到的,这个工具发现了一些错误。
In order to guarantee the safety of your data [12] , Pacemaker ships with STONITH [13] enabled. However it also knows when no STONITH configuration has been supplied and reports this as a problem (since the cluster would not be able to make progress if a situation requiring node fencing arose).
目前,我们禁用这个特性,然后在 配置STONISH 章节来配置它。这里要指出,使用STONITH是非常有必要的。关闭这个特性就是告诉集群:假装故障的节点已经安全的关机了。一些供应商甚至不允许这个特性被关闭。
我们将 stonith-enabled设置为 false 来关闭STONITH
# crm configure property stonith-enabled=false
# crm_verify -L
设置完这个选项以后,校验配置文件就正常了。

警告

The use of stonith-enabled=false is completely inappropriate for a production cluster. We use it here to defer the discussion of its configuration which can differ widely from one installation to the next. See 第 9.1 节 “What Is STONITH” for information on why STONITH is important and details on how to configure it.


[12] If the data is corrupt, there is little point in continuing to make it available
[13] A common node fencing mechanism. Used to ensure data integrity by powering off "bad" nodes