Can an LSB-compliant script be used as a resource in Pacemaker clusters?

Solution Verified - Updated

Environment

  • Red Hat Enterprise Linux 6, 7, 8, or 9 with High Availability or Resilient Storage Add-On
  • Pacemaker cluster

Issue

  • Can an LSB-compliant script be used as a resource in RHEL 6, 7, 8, and 9 pacemaker clusters?
  • How can an LSB-compliant script be added as a resource to Pacemaker?

Resolution

pacemaker can manage LSB scripts that are Content from clusterlabs.org is not included.LSB-compliant scripts natively that are shipped with Red Hat or 3rd party scripts. LSB scripts that are not provided by Red Hat are not supported by Red Hat.

For more information see:


RHEL 8 and earlier

  • /etc/init.d/ has historically been a symlink to /etc/rc.d/init.d/. In the example below, placing the LSBDummy script in /etc/init.d/ would actually use /etc/rc.d/init.d/.

RHEL 9

  • RHEL9 has deprecated the /etc/init.d symlink. When deploying an LSB script to a pacemaker cluster on RHEL 9 and future versions, please make sure to place the script file directly in /etc/rc.d/init.d/.

How To

In this example we you use the following script: Content from github.com is not included.pacemaker/cts/support/LSBDummy.in. This script is not supported.

Note: Starting with RHEL 9, replace the /etc/init.d directory with /etc/rc.d/init.d : Lsb resource is not listed in pcs resource list

  1. Download the LSB script:

      # wget -O /etc/init.d/LSBDummy https://raw.githubusercontent.com/ClusterLabs/pacemaker/main/cts/support/LSBDummy.in
    
  2. Edit the LSB script in order for it start, stop, monitor successfully with pacemaker.

     # diff /etc/init.d/LSBDummy.org /etc/init.d/LSBDummy
     --- /etc/init.d/LSBDummy.org	2023-08-03 11:02:35.380139070 -0400
     +++ /etc/init.d/LSBDummy	2023-08-03 11:02:40.880139968 -0400
     @@ -14,7 +14,8 @@
     # Initialization:
      
     desc="Dummy LSB service"
     -. @OCF_ROOT_DIR@/resource.d/heartbeat/.ocf-directories
     +: ${OCF_FUNCTIONS_DIR=/usr/lib/ocf/lib/heartbeat}
     +. ${OCF_FUNCTIONS_DIR}/ocf-directories
     : ${HA_VARRUN=/tmp} # Backup in case .ocf-directories doesn't exist
     
     #######################################################################
    
  3. Ensure that script is Content from clusterlabs.org is not included.LSB-compliant.

     # /etc/init.d/LSBDummy status ; echo "result: $?"
     Dummy LSB service is stopped
     LSBDummy status : 3
     result: 3
     # /etc/init.d/LSBDummy start ; echo "result: $?"
     LSBDummy start : 0 service: [  OK  ]
     result: 0
     # /etc/init.d/LSBDummy status ; echo "result: $?"
     Running OK
     LSBDummy status : 0
     result: 0
     # /etc/init.d/LSBDummy stop ; echo "result: $?"
     LSBDummy stop : 0B service: [  OK  ]
     result: 0
     # /etc/init.d/LSBDummy status ; echo "result: $?"
     Dummy LSB service is stopped
     LSBDummy status : 3
     result: 3
    
  4. The copy the LSB script /etc/init.d/LSBDummy to all the cluster nodes.

     # scp /etc/init.d/LSBDummy rhel82:/etc/init.d/LSBDummy
     # scp /etc/init.d/LSBDummy rhel83:/etc/init.d/LSBDummy
    
  5. Check that script can be seen by pacemaker using command below.

     # pcs resource list | grep "lsb:LSBDummy"
     lsb:LSBDummy - LSBDummy
    
  6. Add the script as cluster resource.

     # pcs resource create lsb_dummy lsb:LSBDummy
    
  7. Check the configuration of the resource and if needed adjust the timeouts for the script start/stop/monitoring action.

     # pcs resource config lsb_dummy
     Resource: lsb_dummy (class=lsb type=LSBDummy)
      Operations:
         force-reload: lsb_dummy-force-reload-interval-0s
          interval=0s
          timeout=15
         monitor: lsb_dummy-monitor-interval-15
          interval=15
          timeout=15
         restart: lsb_dummy-restart-interval-0s
          interval=0s
          timeout=15
         start: lsb_dummy-start-interval-0s
          interval=0s
          timeout=15
        stop: lsb_dummy-stop-interval-0s
         interval=0s
         timeout=15
    
  8. Then verify that the resource can be stopped and started.

     # pcs resource enable lsb_dummy; pcs status | grep lsb_dummy
     * lsb_dummy	(lsb:LSBDummy):	 Started rhel8-1.examplerh.com
     # pcs resource disable lsb_dummy; pcs status | grep lsb_dummy
     * lsb_dummy	(lsb:LSBDummy):	 Stopped (disabled)
    
SBR
Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.