31.3. Disabling, enabling, and banning cluster resources


In addition to the pcs resource move and pcs resource relocate commands, there are a variety of other commands you can use to control the behavior of cluster resources.

31.3.1. Disabling a cluster resource

You can manually stop a running resource and prevent the cluster from starting it again with the following command. Depending on the rest of the configuration, such as constraints, options, and failures, the resource may remain started. If you specify the --wait option, pcs waits up to 'n' seconds for the resource to stop and then returns 0 if the resource is stopped or 1 if the resource has not stopped. If you do not specify n, it defaults to 60 minutes.

Simulating disabling a resource

Ensuring that disabling a resource would not have an effect on other resources can be impossible to do by hand when complex resource relations are set up. To determine what effect disabling a resource will have on other resources, use the pcs resource disable --simulate command to show the effects of disabling a resource while not changing the cluster configuration.

Safely disabling resources

You can specify that a resource be disabled only if disabling the resource would not have an effect on other resources.

  • The pcs resource disable --safe command disables a resource only if no other resources would be affected in any way, such as being migrated from one node to another. The pcs resource safe-disable command is an alias for the pcs resource disable --safe command.
  • The pcs resource disable --safe --no-strict command disables a resource only if no other resources would be stopped or demoted.

Determining the resource IDs of affected resources

The error report that the pcs resource disable --safe command generates if the safe disable operation fails contains the affected resource IDs. If you need to know only the resource IDs of resources that would be affected by disabling a resource, use the --brief option for the pcs resource disable --safe command, which does not provide the full simulation result and prints errors only.

Procedure

  • Stop a running resource and prevent the cluster from starting it again:

    # pcs resource disable resource_id [--wait[=n]]

31.3.2. Enabling a cluster resource

The following command allows the cluster to start a resource. Depending on the rest of the configuration, the resource may remain stopped. If you specify the --wait option, pcs will wait up to 'n' seconds for the resource to start and then return 0 if the resource is started or 1 if the resource has not started. If 'n' is not specified it defaults to 60 minutes.

Procedure

  • Use the following command to allow the cluster to start a resource:

    pcs resource enable resource_id [--wait[=n]]

You can prevent a resource from running on a specified node, or on the current node if no node is specified.

Procedure

  • Prevent a resource from running on a specified node, or on the current node if no node is specified:

    # pcs resource ban resource_id [node] [--promoted] [lifetime=lifetime] [--wait[=n]]
    注意

    When you execute the pcs resource ban command, this adds a -INFINITY location constraint to the resource to prevent it from running on the indicated node. You can execute the pcs resource clear or the pcs constraint delete command to remove the constraint. This does not necessarily move the resources back to the indicated node; where the resources can run at that point depends on how you have configured your resources initially. For information about resource constraints, see Determining which nodes a resource can run on.

  • If you specify the --promoted parameter of the pcs resource ban command, the scope of the constraint is limited to the promoted role and you must specify promotable_id rather than resource_id.
  • You can optionally configure a lifetime parameter for the pcs resource ban command to indicate a period of time the constraint should remain.
  • You can optionally configure a --wait[=n] parameter for the pcs resource ban command to indicate the number of seconds to wait for the resource to start on the destination node before returning 0 if the resource is started or 1 if the resource has not yet started. If you do not specify n, the default resource timeout is used.

31.3.4. Forcing a resource to start on the current node

Use the debug-start parameter of the pcs resource command to force a specified resource to start on the current node, ignoring the cluster recommendations and printing the output from starting the resource. This is mainly used for debugging resources; starting resources on a cluster is (almost) always done by Pacemaker and not directly with a pcs command. If your resource is not starting, it is usually due to either a misconfiguration of the resource (which you debug in the system log), constraints that prevent the resource from starting, or the resource being disabled. You can use this command to test resource configuration, but it should not normally be used to start resources in a cluster.

Procedure

  • Use the debug-start command to force a specified resource to start on the current node:

    # pcs resource debug-start resource_id
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2026 Red Hat
返回顶部