= Pacemaker Tools =

== Using Pacemaker Tools ==

In the dark past, configuring Pacemaker required the administrator to
read and write XML.  In true UNIX style, there were also a number of
different commands that specialized in different aspects of querying
and updating the cluster.

All of that has been greatly simplified with the creation of unified
command-line shells (and GUIs) that hide all the messy XML
scaffolding.

These shells take all the individual aspects required for managing and
configuring a cluster, and packs them into one simple to use command
line tool.

They even allow you to queue up several changes at once and commit
them atomically.

There are currently two command-line shells that people use, `pcs` and
`crmsh`.  This edition of Clusters from Scratch is based on
+{cli_name}+.  Start by taking some time to familiarize yourself with
what it can do.

[NOTE]
===========
The two shells share many concepts but the scope, layout and syntax
does differ, so make sure you read the version of this guide that
corresponds to the software installed on your system.
===========

ifdef::pcs[]

[IMPORTANT]
===========
Since `pcs` has the ability to manage all aspects of the cluster (both
corosync and pacemaker), it requires a specific cluster stack to be in
use, (corosync 2.0 with votequorum + Pacemaker version >= 1.1.8).
===========

[source,C]
# pcs

.....
Control and configure pacemaker and corosync.

Options:
    -h, --help  Display usage and exit
    -f file     Perform actions on file instead of active CIB
    --debug     Print all network traffic and external commands run
    --version   Print pcs version information

Commands:
    cluster     Configure cluster options and nodes
    resource    Manage cluster resources
    stonith     Configure fence devices
    constraint  Set resource constraints
    property    Set pacemaker properties
    status      View cluster status
    config      Print full cluster configuration
.....

As you can see, the different aspects of cluster management are broken
up into categories: resource, cluster, stonith, property, constraint,
and status. To discover the functionality available in each of these
categories, one can issue the command 'pcs <category> help'.  Below
is an example of all the options available under the status category.

[source,C]
# pcs status help

.....
Usage: pcs status [commands]...
View current cluster and resource status
Commands:
    [status]
        View all information about the cluster and resources

    resources
        View current status of cluster resources

    groups
        View currently configured groups and their resources

    cluster
        View current cluster status

    corosync
        View current membership information as seen by corosync

    nodes [corosync|both|config]
        View current status of nodes from pacemaker. If 'corosync' is
        specified, print nodes currently configured in corosync, if 'both'
        is specified, print nodes from both corosync & pacemaker.  If 'config'
        is specified, print nodes from corosync & pacemaker configuration.

    pcsd <node> ...
        Show the current status of pcsd on the specified nodes

    xml
        View xml version of status (output from crm_mon -r -1 -X)

.....

Additionally, if you are interested in the Pacemaker version and
supported cluster stack(s) available with your current Pacemaker
installation, the pacemakerd --features option is available to you.


[source,C]
# pacemakerd --features

------------------
sys::[pacemakerd --features]
------------------

[NOTE]
======
If the SNMP and/or email options are not listed, then Pacemaker was not
built to support them. This may be by the choice of your distribution or
the required libraries may not have been available. Please contact
whoever supplied you with the packages for more details.
======

endif::[]

ifdef::crmsh[]
pass:[# <command>crm --help</command>]

The primary tool for monitoring the status of the cluster is crm_mon
(also available as crm status). It can be run in a variety of modes
and has a number of output options. To find out about any of the tools
that come with Pacemaker, simply invoke them with the --help option or
consult the included man pages. Both sets of output are created from
the tool, and so will always be in sync with each other and the tool
itself.

Additionally, the Pacemaker version and supported cluster stack(s) are
available via the --feature option to pacemakerd.

[source,C]
# pacemakerd --features

------------------
sys::[pacemakerd --features]
------------------

[source,C]
# crm_mon --help

------------------
sys::[crm_mon --help]
------------------

[NOTE]
======
If the SNMP and/or email options are not listed, then Pacemaker was not
built to support them. This may be by the choice of your distribution or
the required libraries may not have been available. Please contact
whoever supplied you with the packages for more details.
======
endif::[]
