  <appendix id="ap-install">
    <title>Installation</title>
    <section id="s-install-stack">
      <title>Choosing a Cluster Stack</title>
      <para>Ultimately the choice of cluster stack is a personal decision that must be made in the context of you or your company's needs and strategic direction. Pacemaker currently functions equally well with both stacks.</para>
      <para>Here are some factors that may influence the decision</para>
      <itemizedlist>
	<listitem>
          <para>SUSE/Novell, Red Hat and Oracle are all putting their collective weight behind the Corosync cluster stack.</para>
	</listitem>
	<listitem>
          <para>Corosync is an OSI Certified implementation of an industry standard (the Service Availability Forum Application Interface Specification).</para>
	</listitem>
	<listitem>
          <para>Using Corosync gives your applications access to the following additional cluster services</para>
	  <itemizedlist>
	    <listitem><para>
	      checkpoint service
	    </para></listitem>
	    <listitem><para>
	      distributed locking service
	    </para></listitem>
	    <listitem><para>
	      extended virtual synchrony service
	    </para></listitem>
	    <listitem><para>
	      cluster closed process group service
	    </para></listitem>
	  </itemizedlist>
	</listitem>
	<listitem>
          <para>It is likely that Pacemaker, at some point in the future, will make use of some of these additional services not provided by Heartbeat</para>
	</listitem>
	<listitem>
          <para>To date, Pacemaker has received less real-world testing on Corosync than it has on Heartbeat.</para>
	</listitem>
      </itemizedlist>
    </section>
    <section id="s-install-enable">
      <title>Enabling Pacemaker</title>
      <section id="s-install-enable-ais">
	<title>For Corosync</title>
	<para>The Corosync configuration is normally located in <filename>/etc/corosync/corosync.conf</filename> and an example for a machine with an address of 1.2.3.4 in a cluster communicating on port 1234 (without peer authentication and message encryption) is shown below.</para>
	<example>
	  <title>An example Corosync configuration file</title>
	  <programlisting>
  totem {
      version: 2
      secauth: off
      threads: 0
      interface {
          ringnumber: 0
          bindnetaddr: 1.2.3.4
          mcastaddr: 226.94.1.1
          mcastport: 1234
      }
  }
  logging {
      fileline: off
      to_syslog: yes
      syslog_facility: daemon
  }
  amf {
      mode: disabled
  }
	</programlisting>
	  </example>
	<para>The logging should be mostly obvious and the amf section refers to the Availability Management Framework and is not covered in this document.</para>
	<para>The interesting part of the configuration is the totem section. This is where we define the how the node can communicate with the rest of the cluster and what protocol version and options (including encryption<footnote>
            <para>Please consult the <ulink url="http://www.corosync.org/">Corosync website</ulink> and documentation for details on enabling encryption and peer authentication for the cluster.</para>
	  </footnote>) it should use. Beginners are encouraged to use the values shown and modify the interface section based on their network. </para>
	<para>It is also possible to configure Corosync for an IPv6 based environment. Simply configure bindnetaddr and mcastaddr with their IPv6 equivalents. Eg </para>
	<example>
	  <title>Example options for an IPv6 environment</title>
	  <programlisting>
  bindnetaddr: fec0::1:a800:4ff:fe00:20 
  mcastaddr: ff05::1
	  </programlisting>
	</example>
	<para>To tell Corosync to use the Pacemaker cluster manager, add the following fragment to a functional Corosync configuration and restart the cluster.</para>
	<example>
	  <title>Configuration fragment for enabling Pacemaker under Corosync</title>
	  <programlisting>
  aisexec {
    user:  root
    group: root
  }
  service {
    name: pacemaker
    ver: 0
  }
	  </programlisting>
	</example>
	<para>The cluster needs to be run as root so that its child processes (the lrmd in particular) have sufficient privileges to perform the actions requested of it. After-all, a cluster manager that can't add an IP address or start apache is of little use.</para>
	<para>The second directive is the one that actually instructs the cluster to run Pacemaker.</para>
      </section>
      <section id="s-install-enable-heartbeat">
	<title>For Heartbeat</title>
	<para>Add the following to a functional <filename>ha.cf</filename> configuration file and restart Heartbeat</para>
	<example>
	  <title>Configuration fragment for enabling Pacemaker under Heartbeat</title>
	  <programlisting>
  crm respawn
	  </programlisting>
	</example>
      </section>
    </section>
  </appendix>
