manually stopping and starting heartbeat2 resources from commandline (HEARTBEAT)

This document (7002020) is provided subject to the disclaimer at the end of this document.

Environment

SUSE Linux Enterprise Server 10 Service Pack 2
SUSE Linux Enterprise Server 10 Service Pack 1

Situation

The aim is to change a heartbeat2 resource from the commandline from either running to stop or from stopped to started. This can normally be achieved by using the GUI without worrying about syntax issues. Under specific circumstances it might be necessary to do this from the commandline. Maybe because the GUI is not available or for scripting.

Resolution

To change a resource in heartbeat2 from the commandline from stopped to started issue

   crm_resource -r resource_t1 --meta -p target_role -v started

to change a resource in heartbeat2 from the commandline from started to stopped issue

   crm_resource -r resource_t1 --meta -p target_role -v stopped

these commands can be issued from any node of the cluster and one should be root to do this.

Example: there be a 3 node cluster with the following entry in cib.xml

   <primitive id="resource_t1" class="lsb" type="nfsserver" provider="heartbeat">
     <meta_attributes id="resource_t1_meta_attrs">
       <attributes>
         <nvpair id="resource_t1_metaattr_target_role" name="target_role" value="stopped"/>
       </attributes>
     </meta_attributes>
   </primitive>

this means that a resource nfsserver with the name "resource_t1" has the target role stopped. The cluster will stop the resource.

To start this from the commandline the command is:

   crm_resource -r resource_t1 --meta -p target_role -v started

and will result in

   <primitive id="resource_t1" class="lsb" type="nfsserver" provider="heartbeat">
     <meta_attributes id="resource_t1_meta_attrs">
       <attributes>
         <nvpair id="resource_t1_metaattr_target_role" name="target_role" value="started"/>
       </attributes>
     </meta_attributes>
   </primitive>

this is consistant with modifications done via the GUI so the syntax

   crm_resource -r RESOURCE_NAME --meta -p target_role -v (started or stopped)

will start and stop a heartbeat2 resource from the commandline as if done via the GUI.
 

Additional Information

Reminder 1: the default behaviour of the cluster is to start a resource. So if there is no target role given or if the target role is deleted the cluster will revert to "started"

Reminder 2: to omit the --meta in the crm_resource command will produce a second entry in the cib.xml so the result of a

   crm_resource -r resource_t1 -p target_role -v started

could be entries like

   <primitive id="resource_t1" class="lsb" type="nfsserver" provider="heartbeat">
     <meta_attributes id="resource_t1_meta_attrs">
       <attributes>
         <nvpair id="resource_t1_metaattr_target_role" name="target_role" value="started"/>
       </attributes>
     </meta_attributes>
     <instance_attributes id="resource_t1">
       <attributes>
         <nvpair id="resource_t1-target_role" name="target_role" value="started"/>
       </attributes>
     </instance_attributes>
   </primitive>

which can lead to unpredictable behaviour of the cluster to start and stop commands.
 

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:7002020
  • Creation Date: 26-Nov-2008
  • Modified Date:25-Mar-2021
    • SUSE Linux Enterprise Server

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback@suse.com

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

Join Our Community

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.


SUSE Customer Support Quick Reference Guide SUSE Technical Support Handbook Update Advisories
Support FAQ

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.

Go to Customer Center