List:Commits« Previous MessageNext Message »
From:plavin Date:May 9 2007 2:49pm
Subject:svn commit - mysqldoc@docsrva: r6398 - trunk/refman-5.0
View as plain text  
Author: plavin
Date: 2007-05-09 16:49:06 +0200 (Wed, 09 May 2007)
New Revision: 6398

Log:
Really add section file, DRBD How To 

Added:
   trunk/refman-5.0/drbd-how-to.xml


Added: trunk/refman-5.0/drbd-how-to.xml
===================================================================
--- trunk/refman-5.0/drbd-how-to.xml	                        (rev 0)
+++ trunk/refman-5.0/drbd-how-to.xml	2007-05-09 14:49:06 UTC (rev 6398)
Changed blocks: 1, Lines Added: 652, Lines Deleted: 0; 15328 bytes

@@ -0,0 +1,652 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
+[
+  <!ENTITY % all.entities SYSTEM "all-entities.ent">
+  %all.entities;
+]>
+<section id="how-to-drbd-heartbeat">
+
+  <title>MySQL How To: DRBD and Heartbeat</title>
+
+  <section id="drbd-overview">
+
+    <title>Overview</title>
+
+    <para>
+      This how-to will cover the setup of DRBD and Heartbeat together
+      with MySQL to provide a Highly Available database environement.
+    </para>
+
+    <para>
+      A few quick notes:
+    </para>
+
+    <para>
+      MyISAM is not recommended to be used with DRBD. Data managed by a
+      DRBD volume should be stored in InnoDB.
+    </para>
+
+    <para>
+      Examples are given for Debian and RedHat. The Debian examples also
+      cover Ubuntu. The RedHat examples are also valid for CentOS,
+      although references to up2date should be replaced by YUM. Users of
+      Gentoo, Slackware or SuSE should hopefully be able to make
+      required changes for their systems.
+    </para>
+
+    <para>
+      This is a general How-To. There are many things not covered, and
+      this only serves as an introduction to the things that are
+      covered. More documentation may be found online, and MySQL
+      Professional Services will be perfectly happy to help you
+      integrate these technologies in your environment, should you
+      desire.
+    </para>
+
+    <section>
+
+      <title>Conventions</title>
+
+      <para>
+        <remark>
+          [PL]I don't think we want to follow these conventions.
+        </remark>
+
+        In the examples in this summary, the following typographical
+        conventions are used.
+      </para>
+
+<programlisting>
+# root commands 
+</programlisting>
+
+      <para>
+        Code to be executed by the root user will be yellow and be
+        preceded by a #.
+      </para>
+
+<programlisting>
+$ code to be executed by a normal user 
+</programlisting>
+
+      <para>
+        Code to be executed by a normal user will be gray and be
+        preceded by a $.
+      </para>
+
+<programlisting>
+&gt; code to be executed within MySQL or CPAN
+</programlisting>
+
+      <para>
+        Code to be executed within MySQL or CPAN will be light green and
+        be preceded by a &gt;.
+      </para>
+
+<programlisting>
+file contents 
+</programlisting>
+
+      <para>
+        Contents of files will be gray.
+      </para>
+
+<programlisting>
+program output
+</programlisting>
+
+      <para>
+        Output from programs will be distinguished by a dark background
+        and white text.
+      </para>
+
+    </section>
+
+  </section>
+
+<!-- start System Setup and Configuration -->
+
+  <section>
+
+    <title>System Setup and Configuration</title>
+
+    <section>
+
+      <title>Config Files</title>
+
+      <para>
+        DRBD is configured through the file /etc/drbd.conf. Heartbeat is
+        configured through the files in /etc/ha.d. All of the
+        configuration files must be kept identical on both machines.
+      </para>
+
+    </section>
+
+    <section>
+
+      <title>Disk Setup</title>
+
+      <para>
+        Each DRBD machine needs a partition to hold the data. Since DRBD
+        replicates a block device, you have to give it an entire block
+        device. This block device will not be available to be mounted
+        while the machine is passive, so this device cannot be your root
+        partition. For the sake of this example, it will be assumed that
+        DRBD will manage /dev/sda6 and we will eventually mount the
+        block device on /drbd.
+      </para>
+
+    </section>
+
+    <section>
+
+      <title>Hostname</title>
+
+      <para>
+        Both DRBD and Heartbeat require that the each machine have a
+        valid hostname. Both will check various configuration settings
+        against the output of uname -n. Assuming a hostname of
+        <replaceable>slprdb032</replaceable>:
+      </para>
+
+      <para>
+        Edit the file <filename>/etc/sysconfig/network</filename> and
+        add the hostname on the <literal>HOSTNAME </literal> line.
+      </para>
+
+<programlisting>
+HOSTNAME=exv02
+</programlisting>
+
+      <para>
+        Set the hostname for the current live system
+      </para>
+
+<programlisting>
+hostname exv02
+</programlisting>
+
+      <para>
+        Add the hostname to the <filename>/etc/hosts </filename>file,
+        associating with the external IP address.
+      </para>
+
+<programlisting>
+10.100.16.32 exv02        
+</programlisting>
+
+    </section>
+
+    <section>
+
+      <title>System Prerequisites</title>
+
+      <para>
+        The sources (or at least the header files) for the kernel must
+        be installed.
+      </para>
+
+      <section>
+
+        <title>Redhat Kernel</title>
+
+<programlisting>
+# up2date kernel-smp-devel kernel-smp
+</programlisting>
+
+        <para>
+          Make sure the kernel-devel package matches the version of the
+          kernel you are running.
+        </para>
+
+      </section>
+
+      <section>
+
+        <title>Debian Kernel</title>
+
+<programlisting>
+# apt-get install linux-headers linux-image-server         
+</programlisting>
+
+        <para>
+          There are a plethora of different kernel image types depending
+          on whether you are running Ubuntu or Debian and which version.
+          Pick one, just make sure you're up to date.
+        </para>
+
+      </section>
+
+      <section>
+
+        <title>Reboot</title>
+
+        <para>
+          Because you have now most likely installed a new kernel
+          version, you must reboot, so that the current running kernel
+          matches the installed kernel sources.
+        </para>
+
+<programlisting>
+# shutdown -r now
+</programlisting>
+
+        <para>
+          Building heartbeat and DRBD requires some other prerequisite
+          packages.
+        </para>
+
+      </section>
+
+      <section>
+
+        <title>Redhat Devel Packages</title>
+
+<programlisting>
+# up2date glib-devel openssl-devel libgcrypt-devel glib2-devel \
+pkgconfig ncurses-devel rpm-build rpm-devel redhat-rpm-config gcc \
+gcc-c++ bison flex gnutls-devel lm_sensors-devel net-snmp-devel \
+python-devel bzip2-devel libselinux-devel perl-DBI          
+</programlisting>
+
+        <para>
+          If you aren't building heartbeat or DRBD but are using built
+          RPMs you may need.
+        </para>
+
+<programlisting>
+# up2date gnutls lm_sensors net-snmp ncurses libgcrypt glib2 openssl glib
+</programlisting>
+
+        <para>
+          A package called libnet is required. Download and rebuild the
+          latest source RPM from ultramonkey.org. It is ok to use the
+          source RPM packaged for RHEL3 on RHEL4 systems.
+        </para>
+
+<programlisting>
+rpmbuild --rebuild http://www.ultramonkey.org/download/3/rh.el.3/SRPMS/libnet-1.1.2.1-1.rh.el.um.1.src.rpm
+</programlisting>
+
+        <para>
+          The install the libnet RPMs:
+        </para>
+
+<programlisting>
+# cd /usr/src/redhat/RPMS/i386/
+# rpm -Uvh libnet-1.1.2.1-1.rh.el.um.1.i386.rpm
+</programlisting>
+
+      </section>
+
+      <section>
+
+        <title>Debian</title>
+
+        <para>
+          Of course, you don't really need to worry about prerequisites
+          if you are running debian so much. To setup bonding, you'll
+          need:
+        </para>
+
+<programlisting>
+    # apt-get install ifenslave
+  </programlisting>
+
+        <para>
+          If you decide you might like to build from source, the
+          following will be helpful.
+        </para>
+
+<programlisting>
+    # apt-get install devscripts flex bison build-essential \
+    dpkg-dev kernel-package debconf-utils dpatch debhelper \
+    libnet1-dev e2fslibs-dev libglib2.0-dev automake1.9 \
+    libgnutls-dev libtool libltdl3 libltdl3-dev
+  </programlisting>
+
+      </section>
+
+    </section>
+
+<!-- end system prerequisites -->
+
+  </section>
+
+<!-- end System Setup and Configuration -->
+
+<!-- start Bonding -->
+
+  <section>
+
+    <title>Bonding Setup</title>
+
+    <para>
+      In order to maximize system stability, each machine should contain
+      at least two 2-port NIC cards, which will be bonded together.
+      Should you choose not to do this, replace subsequent references to
+      bonded interfaces with regular onees.
+    </para>
+
+    <para>
+      Each machine should have a public network connection (bond0) and a
+      private network segment (bond1). The private segment is used for
+      replication. It is recommended that one port from each is used for
+      each virtual interface. The end result will be that there will be
+      a direct connection cable from one port of each interface to the
+      same port on the other machine of the pair, and a cable from each
+      of the remaining ports plugged in to the public switch. It's even
+      more robust to then have dual redundant switches with one public
+      cable plugged in to each. When setting up the cabling, it should
+      be determined which physical interface corresponds to the logical
+      names eth0, eth1, eth2 and eth3 and this should be explicitly
+      configured to ensure that kernel upgrades don't cause interface
+      names to drift.
+    </para>
+
+    <section>
+
+      <title>Kernel Configuration</title>
+
+      <para>
+        The kernel must be configured to understand the interface
+        bonding. Usually this is done through loadable modules. If you
+        have decided to compile modules directly in to the kernel, you
+        are on your own.
+      </para>
+
+      <para>
+        In the following configuration, each interface is configured to
+        run in an Active/Passive failover manner (mode=1) and to check
+        the status of each of its underlying physical interfaces every
+        100ms (miimon=100). Other bonding modes are available, including
+        modes for load-balancing. Information on bonding modes can be
+        found in the kernel documentation:
+        http://www.mjmwired.net/kernel/Documentation/networking/bonding.txt
+      </para>
+
+      <section>
+
+        <title>Redhat</title>
+
+        <para>
+          Because of limitations in RedHat's initscripts package, it is
+          not possible for each bond interface to carry different
+          parameters, although that is usually acceptable. The following
+          configuration should be added to /etc/modprobe.conf.
+        </para>
+
+<programlisting>
+alias bond0 bonding
+alias bond1 bonding
+options bonding max_bonds=2
+options bond0 miimon=100 mode=1
+options bond1 miimon=100 mode=1
+</programlisting>
+
+      </section>
+
+      <section>
+
+        <title>Debian</title>
+
+        <para>
+          Add a file called bonding to /etc/modprobe.d:
+        </para>
+
+<programlisting>
+alias bond0 bonding
+alias bond1 bonding
+options bonding mode=1 miimon=100
+</programlisting>
+
+        <para>
+          Each bonded interface is configured to run in a Round Robin
+          manner (mode=0) and to check the status of each of its
+          underlying physical interfaces every 100ms (miimon=100).
+        </para>
+
+      </section>
+
+    </section>
+
+<!--end Kernel configuration-->
+
+<!--start Network Interfaces -->
+
+    <section>
+
+      <title>Network Interfaces</title>
+
+      <para>
+        If the system contains two dual-nic cards, the interfaces should
+        be matched to bonded interfaces such that one nic from each card
+        is associated with a bonded interface.
+      </para>
+
+      <para>
+        bond1 should be configured with a local non-routable private
+        subnet. An easily manageable system such as the normal active
+        host being 192.168.0.1 and the normal passive host being
+        192.168.0.2 should be used.
+      </para>
+
+      <para>
+        Once the bonds are set up, ensure that each machine can talk to
+        the other over the private network and that each machine can
+        talk to the public network.
+      </para>
+
+      <section>
+
+        <title>Redhat</title>
+
+        <para>
+          Configuration for bonded interfaces are in
+          /etc/sysconfig/network-scripts/ifcfg-bondX:
+        </para>
+
+<programlisting>
+DEVICE=bondX
+BOOTPROTO=none
+ONBOOT=yes
+GATEWAY=10.0.0.1
+NETWORK=10.0.0.0
+NETMASK=255.255.255.0
+IPADDR=10.0.0.11
+USERCTL=no
+</programlisting>
+
+        <para>
+          And the configuration for the underlying interfaces in
+          /etc/sysconfig/network-scripts/ifcfg-ethX:
+        </para>
+
+<programlisting>
+DEVICE=ethX
+BOOTPROTO=none
+HWADDR=00:11:22:33:44:55
+ONBOOT=yes
+TYPE=Ethernet
+MASTER=bondX
+SLAVE=yes
+</programlisting>
+
+        <para>
+          Running /etc/init.d/network restart at this point should
+          configure all of the interfaces using the bonded interfaces.
+        </para>
+
+      </section>
+
+    </section>
+
+<!-- end Network Interfaces -->
+
+<!-- start Debian (under bonding still) -->
+
+    <section>
+
+      <title>Debian</title>
+
+      <para>
+        Add an entry to /etc/iftab for each interface specifying the
+        logical name and the MAC address. Each line will resemble:
+      </para>
+
+<programlisting>
+eth0 mac 00:11:22:33:44:55
+</programlisting>
+
+      <para>
+        Edit /etc/network/interfaces:
+      </para>
+
+<programlisting>
+auto bond0
+iface bond0 inet static
+  address 10.0.0.10
+  netmask 255.255.255.0
+  network 10.0.0.0
+  gateway 10.0.0.1
+  up /sbin/ifenslave bond0 eth0
+  up /sbin/ifenslave bond0 eth2
+  
+auto bond1
+iface bond1 inet static
+  address 192.168.0.1
+  netmask 255.255.255.0
+  network 192.168.0.0
+  up /sbin/ifenslave bond1 eth1
+  up /sbin/ifenslave bond1 eth3
+</programlisting>
+
+      <para>
+        The public and private IP Addresses should obviously be changed
+        to match the settings on this machine.
+      </para>
+
+    </section>
+
+<!-- end Debian (under bonding still) -->
+
+<!-- start status (under bonding still) -->
+
+    <section>
+
+      <title>Status</title>
+
+      <para>
+        Bonding status can be monitored in /proc/net/bonding/bondX. For instance:
+      </para>
+      
+      <programlisting>
+        # cat /proc/net/bonding/bond0 
+      </programlisting>
+      
+      <para>
+        produces:
+      </para>
+      
+<programlisting>
+  Bonding Mode: fault-tolerance (active-backup)
+  Primary Slave: None
+  Currently Active Slave: eth1
+  MII Status: up
+  MII Polling Interval (ms): 100
+  Up Delay (ms): 200
+  Down Delay (ms): 200
+  
+  Slave Interface: eth1
+  MII Status: up
+  Link Failure Count: 0
+  Permanent HW addr: 00:11:22:33:44:55
+  
+  Slave Interface: eth2
+  MII Status: up
+  Link Failure Count: 0
+  Permanent HW addr: 00:11:22:33:44:56
+</programlisting>
+
+    </section>
+
+<!-- end status (under bonding still) -->
+
+  </section>
+
+<!--end bonding setup -->
+
+<!-- -->
+
+  <section>
+
+    <title>DRBD Setup</title>
+
+    <para></para>
+
+  </section>
+
+<!-- -->
+
+<!-- -->
+
+  <section>
+
+    <title></title>
+
+    <para></para>
+
+  </section>
+
+<!-- -->
+
+<!-- -->
+
+  <section>
+
+    <title></title>
+
+    <para></para>
+
+  </section>
+
+<!-- -->
+
+<!-- -->
+
+  <section>
+
+    <title></title>
+
+    <para></para>
+
+  </section>
+
+<!-- -->
+
+<!-- -->
+
+  <section>
+
+    <title></title>
+
+    <para></para>
+
+  </section>
+
+<!-- -->
+
+<!-- -->
+
+  <section>
+
+    <title></title>
+
+    <para></para>
+
+  </section>
+
+<!-- -->
+
+</section>


Thread
svn commit - mysqldoc@docsrva: r6398 - trunk/refman-5.0plavin9 May