Show Table of Contents
7.4. 启用、禁用和禁止集群资源
除 第 7.1 节 “在集群中手动移动资源” 所述
pcs resource move 命令外,还有其他不同的命令可用于控制集群资源行为。
使用以下命令可手动停止运行的资源,并防止集群再次启动该资源。根据其余的配置(限制、选项、失败等等),该资源可能仍保持启动状态。如果指定
--wait 选项,pcs 会等待 30 秒(或 ‘n’ 秒)以便资源停止。如果资源停止,则会返回数值 0,否则就返回数值 1。
pcs resource disable resource_id [--wait[=n]]
可使用以下命令允许集群启动某个资源。该资源可能仍处于停止状态,具体要看其他配置。如果指定
--wait 选项,pcs 会等待 30 秒(或 ‘n’ 秒)以便资源启动。如果资源启动,则会返回数值 0,否则就返回数值 1。
pcs resource enable resource_id [--wait[=n]]
使用以下命令防止资源在指定节点中运行。如果未指定节点,则防止其在当前节点中运行。
pcs resource ban resource_id [node]
注:执行
pcs resource ban 命令时,会在该资源中添加限制,以防止其在指示的节点中运行。执行 pcs resource clear 命令时会删除这些限制。这样就无需将该节点移回指示的节点。此时该资源运行的地点由资源最初配置的位置决定。有关资源限制的详情,请参考 第 6 章 资源限制。
pcs resource clear resource_id [node]
可使用
pcs resource 命令的 debug-start 参数强制在当前节点中启动指定的资源,忽略集群建议,并显示启动的资源的输出结果。这主要用于 debug 资源。在集群中启动资源通常由 Pacemaker 指定,而不是直接使用 pcs 命令。如果您的资源未启动,一般是由于资源的错误配置(参看系统日志)限制了资源的启动,或者该资源已被禁用。可使用这个命令测试资源配置,但一般不用于在集群中启动资源。
debug-start 命令的格式如下。
pcs resource debug-start resource_id

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.