+The tool uses the same library as the live cluster to show what it
+would have done given the supplied input. It's output, in addition to
+a significant amount of logging, is stored in two files +tmp.graph+
+and +tmp.dot+, both are representations of the same thing -- the
+cluster's response to your changes.
+
+In the graph file is stored the complete transition, containing a list
+of all the actions, their parameters and their pre-requisites.
+Because the transition graph is not terribly easy to read, the tool
+also generates a Graphviz dot-file representing the same information.
+
+== Interpreting the Graphviz output ==
+ * Arrows indicate ordering dependencies
+ * Dashed-arrows indicate dependencies that are not present in the transition graph
+ * Actions with a dashed border of any color do not form part of the transition graph
+ * Actions with a green border form part of the transition graph
+ * Actions with a red border are ones the cluster would like to execute but cannot run
+ * Actions with a blue border are ones the cluster does not feel need to be executed
+ * Actions with orange text are pseudo/pretend actions that the cluster uses to simplify the graph
+ * Actions with black text are sent to the LRM
+ * Resource actions have text of the form pass:[<replaceable>rsc</replaceable>]_pass:[<replaceable>action</replaceable>]_pass:[<replaceable>interval</replaceable>] pass:[<replaceable>node</replaceable>]
+ * Any action depending on an action with a red border will not be able to execute.
+ * Loops are _really_ bad. Please report them to the development team.
+
+=== Small Cluster Transition ===
+
+image::images/Policy-Engine-small.png["An example transition graph as represented by Graphviz",width="16cm",height="6cm",align="center"]
+
+In the above example, it appears that a new node, +node2+, has come
+online and that the cluster is checking to make sure +rsc1+, +rsc2+
+and +rsc3+ are not already running there (Indicated by the
++*_monitor_0+ entries). Once it did that, and assuming the resources
+were not active there, it would have liked to stop +rsc1+ and +rsc2+
+on +node1+ and move them to +node2+. However, there appears to be
+some problem and the cluster cannot or is not permitted to perform the
+stop actions which implies it also cannot perform the start actions.
+For some reason the cluster does not want to start +rsc3+ anywhere.
+
+For information on the options supported by ptest, use
+pass:[<command>ptest --help</command>].
+
+=== Complex Cluster Transition ===
+
+image::images/Policy-Engine-big.png["Another, slightly more complex, transition graph that you're not expected to be able to read",width="16cm",height="20cm",align="center"]
+
+== Do I Need to Update the Configuration on all Cluster Nodes? ==
+
+No. Any changes are immediately synchronized to the other active
+members of the cluster.
+
+To reduce bandwidth, the cluster only broadcasts the incremental
+updates that result from your changes and uses MD5 checksums to ensure
- <para>The cluster is written using XML notation and divided into two main sections: configuration and status.</para>
- <para>
- The status section contains the history of each resource on each node and based on this data, the cluster can construct the complete current state of the cluster.
- The authoritative source for the status section is the local resource manager (lrmd) process on each cluster node and the cluster will occasionally repopulate the entire section.
- For this reason it is never written to disk and administrators are advised against modifying it in any way.
- </para>
- <para>
- The configuration section contains the more traditional information like cluster options, lists of resources and indications of where they should be placed.
- The configuration section is the primary focus of this document.
- </para>
- <para>The configuration section itself is divided into four parts:</para>
- Before one starts to configure a cluster, it is worth explaining how to view the finished product.
- For this purpose we have created the <command>crm_mon</command> utility that will display the current state of an active cluster.
- It can show the cluster status by node or by resource and can be used in either single-shot or dynamically-updating mode.
- There are also modes for displaying a list of the operations performed (grouped by node and resource) as well as information about failures.
- </para>
- <para>Using this tool, you can examine the state of the cluster for irregularities and see how it responds when you cause or simulate failures.</para>
- <para>Details on all the available options can be obtained using the <command>crm_mon --help</command> command.</para>
- <figure id="fig-output-crm_mon">
- <title>Sample output from crm_mon</title>
- <screen><command># crm_mon</command>
- ============
- Last updated: Fri Nov 23 15:26:13 2007
- Current DC: sles-3 (2298606a-6a8c-499a-9d25-76242f7006ec)
- child_DoFencing:2 (stonith:external/vmware): Started sles-1</screen>
- </figure>
- <para>
- The DC (Designated Controller) node is where all the decisions are made and if the current DC fails a new one is elected from the remaining cluster nodes.
- The choice of DC is of no significance to an administrator beyond the fact that its logs will generally be more interesting.
- </para>
- </section>
- <section id="s-config-updates">
- <title>How Should the Configuration be Updated?</title>
- <para>There are three basic rules for updating the cluster configuration:</para>
- <itemizedlist spacing="compact">
- <listitem><para>Rule 1 - Never edit the cib.xml file manually. Ever. I'm not making this up.</para></listitem>
- <listitem><para>Rule 3 - The cluster will notice if you ignored rules 1 & 2 and refuse to use the configuration.</para></listitem>
- </itemizedlist>
- <para>Now that it is clear how NOT to update the configuration, we can begin to explain how you should.</para>
- <para>
- The most powerful tool for modifying the configuration is the <literal>cibadmin</literal> command which talks to a running cluster.
- With <literal>cibadmin</literal>, the user can query, add, remove, update or replace any part of the configuration; all changes take effect immediately, so there is no need to perform a reload-like operation.
- </para>
- <para>The simplest way of using cibadmin is to use it to save the current configuration to a temporary file, edit that file with your favorite text or XML editor and then upload the revised configuration.</para>
- <figure id="fig-config-editor">
- <title>Safely using an editor to modify the cluster configuration</title>
- <title>Making Configuration Changes in a Sandbox</title>
- <para>
- Often it is desirable to preview the effects of a series of changes before updating the configuration atomically.
- For this purpose we have created <command>crm_shadow</command> which creates a "shadow" copy of the configuration and arranges for all the command line tools to use it.
- </para>
- <para>
- To begin, simply invoke <command>crm_shadow</command> and give it the name of a configuration to create<footnote>
- <para>Shadow copies are identified with a name, making it possible to have more than one.</para>
- </footnote>; be sure to follow the simple on-screen instructions.
- <warning><para>Read the above carefully, failure to do so could result in you destroying the cluster's active configuration!</para></warning>
- </para>
- <figure id="fig-config-sandbox">
- <title>Creating and displaying the active sandbox</title>
- <para>Making changes in a sandbox and verifying the real configuration is untouched</para>
- </example>
- </section>
- <section id="s-config-testing-changes">
- <title>Testing Your Configuration Changes</title>
- <para>
- We saw previously how to make a series of changes to a "shadow" copy of the configuration.
- Before loading the changes back into the cluster (eg. <command>crm_shadow --commit mytest --force</command>), it is often advisable to simulate the effect of the changes with <literal>ptest</literal>, eg.
- The tool uses the same library as the live cluster to show what it would have done given the supplied input.
- It's output, in addition to a significant amount of logging, is stored in two files <filename>tmp.graph</filename> and <filename>tmp.dot</filename>, both are representations of the same thing -- the cluster's response to your changes.
- In the graph file is stored the complete transition, containing a list of all the actions, their parameters and their pre-requisites.
- Because the transition graph is not terribly easy to read, the tool also generates a Graphviz dot-file representing the same information.
- <listitem><para>Dashed-arrows indicate dependencies that are not present in the transition graph</para></listitem>
- <listitem><para>Actions with a dashed border of any color do not form part of the transition graph</para></listitem>
- <listitem><para>Actions with a green border form part of the transition graph</para></listitem>
- <listitem><para>Actions with a red border are ones the cluster would like to execute but cannot run</para></listitem>
- <listitem><para>Actions with a blue border are ones the cluster does not feel need to be executed</para></listitem>
- <listitem><para>Actions with orange text are pseudo/pretend actions that the cluster uses to simplify the graph</para></listitem>
- <listitem><para>Actions with black text are sent to the LRM</para></listitem>
- <listitem><para>Resource actions have text of the form <replaceable>rsc</replaceable>_<replaceable>action</replaceable>_<replaceable>interval</replaceable> <replaceable>node</replaceable></para></listitem>
- <listitem><para>Any action depending on an action with a red border will not be able to execute. </para></listitem>
- <listitem><para>Loops are <emphasis>really</emphasis> bad. Please report them to the development team. </para></listitem>
- </itemizedlist>
- <para>
- In the above example, it appears that a new node, <literal>node2</literal>, has come online and that the cluster is checking to make sure <literal>rsc1</literal>, <literal>rsc2</literal> and <literal>rsc3</literal> are not already running there (Indicated by the <literal>*_monitor_0</literal> entries).
- Once it did that, and assuming the resources were not active there, it would have liked to stop <literal>rsc1</literal> and <literal>rsc2</literal> on <literal>node1</literal> and move them to <literal>node2</literal>.
- However, there appears to be some problem and the cluster cannot or is not permitted to perform the stop actions which implies it also cannot perform the start actions.
- For some reason the cluster does not want to start <literal>rsc3</literal> anywhere.
- </para>
- <para>For information on the options supported by ptest, use <command>ptest --help</command>.</para>
- <caption>Another, slightly more complex, transition graph that you're not expected to be able to read</caption>
- </mediaobject>
- </figure>
- </para>
- </section>
- <section id="s-config-synchronization">
- <title>Do I Need to Update the Configuration on all Cluster Nodes?</title>
- <para>No. Any changes are immediately synchronized to the other active members of the cluster.</para>
- <para>To reduce bandwidth, the cluster only broadcasts the incremental updates that result from your changes and uses MD5 checksums to ensure that each copy is completely consistent.</para>
- When a node joins the cluster, the cluster will perform a check to see who has the best configuration based on the fields below.
- It then asks the node with the highest (<varname>admin_epoch</varname>, <varname>epoch</varname>, <varname>num_updates</varname>) tuple to replace the configuration on all the nodes - which makes setting them, and setting them correctly, very important.
- <para>Never modified by the cluster. Use this to make the configurations on any inactive nodes obsolete.</para>
- <para><emphasis>Never set this value to zero</emphasis>, in such cases the cluster cannot tell the difference between your configuration and the "empty" one used when nothing is found on disk. </para>
- Determines the type of validation being done on the configuration.
- If set to "none", the cluster will not verify that updates conform to the DTD (nor reject ones that don't). This option can be useful when operating a mixed version cluster during an upgrade.
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- </section>
- <section id="s-options-read-only">
- <title>Fields Maintained by the Cluster</title>
- <table frame="all">
- <title>Properties Maintained by the Cluster</title>
- <entry>Indicates which cluster node is the current leader. Used by the cluster when placing resources and determining the order of some events.</entry>
- <entry>Indicates if the cluster has quorum. If false, this may mean that the cluster cannot start resources or fence other nodes. See <literal>no-quorum-policy</literal> below.</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <para>
- Note that although these fields can be written to by the admin, in most cases the cluster will overwrite any values specified by the admin with the "correct" ones.
- To change the <varname>admin_epoch</varname>, for example, one would use:
- <para>Cluster options, as you might expect, control how the cluster behaves when confronted with certain situations.</para>
- <para>They are grouped into sets and, in advanced configurations, there may be more than one<footnote>
- <para>This will be described later in the section on <xref linkend="ch-rules"/> where we will show how to have the cluster use different sets of options during working hours (when downtime is usually to be avoided at all costs) than it does during the weekends (when resources can be moved to the their preferred hosts without bothering end users)</para>
- </footnote>. For now we will describe the simple case where each option is present at most once.</para>
- <entry>The number of jobs that the TE is allowed to execute in parallel. The "correct" value will depend on the speed and load of your network and cluster nodes.</entry>
- <para>Should failed nodes and nodes with resources that can't be stopped be shot? If you value your data, set up a STONITH device and enable this.</para>
- <para>If true, or unset, the cluster will refuse to start resources unless one or more STONITH resources have been configured also.</para>
- <entry>Round trip delay over the network (excluding action execution). The "correct" value will depend on the speed and load of your network and cluster nodes.</entry>
- <entry>When set to FALSE, the cluster will instead use the resource's <literal>failcount</literal> and value for <literal>resource-failure-stickiness</literal>.</entry>
- <entry>The number of "normal" PE inputs to save. Used when reporting problems.</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <para>You can always obtain an up-to-date list of cluster options, including their default values, by running the <command>pengine metadata</command> command.</para>