Show Table of Contents
7.2. 因宕机移动资源
创建资源时,可配置该资源,以便规定在失败多少次后(使用
migration-threshold 选项为该资源定义),将其移动到一个新节点。达到阈值后,就不再允许该节点运行失败的资源,除非:
- 管理员使用
pcs resource failcount命令手动重置资源失败计数。 - 已达到该资源的
failure-timeout值。
默认不定义阈值。
注意
为某个资源设定
migration-threshold 与配置资源迁移不同,后者是将该资源移至另一个位置,而不会丢失状态。
以下示例在名为
dummy_resource 的资源组合中添加迁移阈值 10,表示在十次失败后会将该资源移至一个新节点。
# pcs resource meta dummy_resource migration-threshold=10
使用以下命令在默认值中为整个集群添加迁移阈值。
# pcs resource defaults migration-threshold=10
请使用
pcs resource failcount 命令确定资源的当前设备状态及限制。
迁移阈值概念有两个例外情况,在某个资源无法启动或无法停止时会出现这两种例外。启动操作失败会将 failcount 设定为
INFINITY,因此结果总是将资源立即移开。
停止操作失败稍有不同,且更严重。如果某个资源无法停止,且同时启用了 STONITH,那么集群就会隔离该节点,以便在其他位置启动该资源。如果未启用 STONITH,则该集群就无法继续运行该资源,也无法尝试着其他位置启动该资源,但仍会在失败超时后继续尝试停止该资源。

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.