Building a Serviceguard Cluster on HP-UX 11.31

I have recently been working alot with HP-UX.  A big part of that work relates to managing Serviceguard clusters, something I have had little previous experience doing.  It was a challenge for me to find any sort of a quick start guide or simplified steps towards building a Serviceguard cluster, so I wanted to combine all the pieces and parts I have Googled and man-paged together so the next person can hopefully find this useful.

Prerequisites

  • Two hosts (nodes) running the same build of HP-UX
  • Same version of Serviceguard installed

Here are the steps to build a ServiceGuard cluster on HP-UX 11.31

  1. Run csshsetup <secondary nodename> on your primary node, enter the root password.
  2. Run csshsetup <primary nodename> on your secondary node, enter the root password.
  3. Run cmpreparecl -n <primarynode> -n <secondarynode> to set up the Serviceguard relationship settings
  4. Create a basic cluster configuration file by running cmquerycl -v -C <clustername.ascii> -n <primarynode> -n <secondarynode>
  5. Edit the newly created ascii file to your specific needs, noting things like:
    • Cluster name
    • IPs
    • Quorum server hosts or volume group
    • Cluster shares storage/volume groups
    • Take some extra time here, this is really important!
  6. Validate the cluster config file by running cmcheckconf -C <clustername.ascii>.  Deal with any warnings or errors that are of concern.  (The setup will apply with warnings, but they should still be considered)
  7. Apply the config and create the cluster by running cmapplyconf -v -C <clustername.ascii>.
  8. Review all the output and make sure the cluster relationship was successful; run cmviewcl which should show both nodes, likely in a “down” state
  9. You can bring up the nodes now if you want, starting with the primary node by running cmrunnode <nodename>. Run cmviewcl again to check and make sure everything looks good.  You’ll see a cluster, and nodes but no packages yet
  10. Now its time to create some packages.  This is where the real meat of Serviceguard starts to develop, so pay special attention to these configurations
    • You can create a very basic template config by running cmmakepkg -m sg/failover -m sg/package_ip <packageconfig.conf> – which would give you failover and IP capabilities
    • Or, you could create a “full” config by running cmmakepkg -m sg/all <packageconfig.conf>.
    • Edit the package config file to suit your needs, consider adding: IP Addresses, package names, filesystems and volume groups
  11. When you’ve got your package config file in order, you can validate it by running cmcheckconf -v -P <packageconfig.conf>.
  12. Review your output and check for any errors.  If you’re satisfied with everything, go ahead and apply the config to create your cluster package!  cmapplyconf -P <packageconfig.conf>
  13. Run a cmviewcl again to check out the cluster now, you should see your newly created cluster package, in a down state.
  14. To  bring the package online, run cmrunpkg -n <nodename> <packagename> and then make sure it is up and running (with another cmviewcl)
  15. Optionally, you can set the package up for auto run by cmmodpkg -e <packagename> to allow it to startup automatically after a failover.

You can also use the HP systems management homepage to click through the steps of creating a Serviceguard cluster, but really where’s the fun in that? 🙂

A list of some of the useful commands to use for Serviceguard clusters:

  • cmviewcl
  • cmquerycl
  • cmrunpkg
  • cmhaltpkg
  • cmrunnode
  • cmcheckconf
  • cmapplyconf
  • cmmakepkg