Author: mcbrown
Date: 2007-07-31 17:58:41 +0200 (Tue, 31 Jul 2007)
New Revision: 7285
Log:
Adding final DRBD chapter (main content)
Modified:
trunk/refman-common/replication-drbd.xml
Modified: trunk/refman-common/replication-drbd.xml
===================================================================
--- trunk/refman-common/replication-drbd.xml 2007-07-31 15:58:15 UTC (rev 7284)
+++ trunk/refman-common/replication-drbd.xml 2007-07-31 15:58:41 UTC (rev 7285)
Changed blocks: 7, Lines Added: 317, Lines Deleted: 25; 13136 bytes
@@ -26,17 +26,26 @@
</para>
<para>
- On the master, for example, the data writes are written both to the
- underlying physical block device and distributed to the slave DRBD
- services. On the slaves, the writes received through DRBD and
- written to the local physical block device. On both the master and
- the slave, reads from the DRBD block device are handled by the
- underlying physical block device. The information is shared between
- the primary DRBD server and the secondary DRBD server synchronously
- and at a block level, and this means that DRBD can be used in
- high-availability solutions where you need failover support.
+ On the primary, for example, the data writes are written both to the
+ underlying physical block device and distributed to the secondary
+ DRBD services. On the secondariess, the writes received through DRBD
+ and written to the local physical block device. On both the primary
+ and the secondary, reads from the DRBD block device are handled by
+ the underlying physical block device. The information is shared
+ between the primary DRBD server and the secondary DRBD server
+ synchronously and at a block level, and this means that DRBD can be
+ used in high-availability solutions where you need failover support.
</para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/published/drbd-main.png" format="PNG"/>
+ </imageobject>
+ <textobject>
+ <phrase lang="en">DRBD Architecture</phrase>
+ </textobject>
+ </mediaobject>
+
<para>
When used with MySQL, DRBD can be used to ensure availability in the
event of a failure. MySQL is configured to store information on the
@@ -122,8 +131,9 @@
<listitem>
<para>
- The node that contains the master data (and in an HA
- environment is the currently active node) is called the
+ The node that contains the primary data, has read/write access to the
+ data, and in an HA
+ environment is the currently active node is called the
<firstterm>primary</firstterm>.
</para>
</listitem>
@@ -732,14 +742,14 @@
<para>
The IP address of eac <literal>on</literal> block must
match the IP address of the corresponding host. Do not set
- this value to the IP address of the corresponding master
- or slave in each case.
+ this value to the IP address of the corresponding primary
+ or secondary in each case.
</para>
</listitem>
<listitem>
<para>
- Before starting the master node, you should create the
+ Before starting the primary node, you should create the
metadata for the devices:
</para>
@@ -787,11 +797,22 @@
<programlisting># mkfs.ext3 /dev/drbd0</programlisting>
</listitem>
+ <listitem>
+ <para>
+ You can now mount the filesystem and if necessary copy
+ files to the mount point:
+ </para>
+
+<programlisting># mkdir /mnt/drbd
+# mount /dev/drbd0 /mnt/drbd
+# echo "DRBD Device" >/mnt/drbd/samplefile</programlisting>
+ </listitem>
+
</orderedlist>
<para>
- Your master node is now ready to use. You should now configure
- your secondary node or nodes.
+ Your primary node is now ready to use. You should now
+ configure your secondary node or nodes.
</para>
</section>
@@ -871,18 +892,167 @@
<section id="replication-drbd-install-drbd-using">
- <title>Monitoring and using your DRBD device</title>
+ <title>Monitoring and Managing your DRBD device</title>
<para>
Once the primary and secondary machines are configured and
- synchronized
+ synchronized, you can get the status information about your
+ DRBD device is to view the output from
+ <filename>/proc/drbd</filename>:
</para>
+<programlisting>version: 8.0.4 (api:86/proto:86)
+SVN Revision: 2947 build by root@drbd-master, 2007-07-30 16:43:05
+ 0: cs:Connected st:Primary/Secondary ds:UpToDate/UpToDate C r---
+ ns:2175704 nr:0 dw:99192 dr:2076641 al:33 bm:128 lo:0 pe:0 ua:0 ap:0
+ resync: used:0/31 hits:134841 misses:135 starving:0 dirty:0 changed:135
+ act_log: used:0/257 hits:24765 misses:33 starving:0 dirty:0 changed:33</programlisting>
+
+ <para>
+ The first line provides the version/revision and build
+ information.
+ </para>
+
+ <para>
+ The second line starts the detailed status information for an
+ individual resource. The individual field headings are as
+ follows:
+ </para>
+
+ <itemizedlist>
+
+ <listitem>
+ <para>
+ cs — connection state
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ st — node state (local/remote)
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ ld — local data consistentency
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ ds — data consistency
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ ns — network send
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ nr — network receive
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ dw — disk write
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ dr — disk read
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ pe — pending (waiting for ack)
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ ua — unack'd (still need to send ack)
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ al — access log write count
+ </para>
+ </listitem>
+
+ </itemizedlist>
+
+ <para>
+ In the previous example, the information shown indicates that
+ the nodes are connected, the local node is the primary
+ (because it is listed first), and the local and remote data is
+ up to date with each other. The remainder of the information
+ is statistical data about the device, and the data exchanged
+ that kept the information up to date.
+ </para>
+
+ <para>
+ For administration, the main command is
+ <command>drbdadm</command>. There are a number of commands
+ supported by this tool the control the connectivity and status
+ of the DRBD devices.
+ </para>
+
+ <para>
+ The most common commands are those to set the
+ primary/secondary status of the local device. You can manually
+ set this information for a number of reasons, including when
+ you want to check the physical status of the secondary device
+ (since you cannot mount a DRBD device in primary mode), or
+ when you are temporarily moving the responsibility of keeping
+ the data in check to a different machine (for example, during
+ an upgrade or physical move of the normal primary node). You
+ can set state of all local device to be the primary using this
+ command:
+ </para>
+
+<programlisting># drbdadm primary all</programlisting>
+
+ <para>
+ Or switch the local device to be the secondary using:
+ </para>
+
+<programlisting># drbdadm secondary all</programlisting>
+
+ <para>
+ To change only a single DRBD resource, specify the resource
+ name instead of <literal>all</literal>.
+ </para>
+
+ <para>
+ You can temporarily disconnect the DRBD nodes:
+ </para>
+
+<programlisting># drbdadm disconnect all</programlisting>
+
+ <para>
+ Reconnect them using <literal>connect</literal>:
+ </para>
+
+<programlisting># drbdadm connect all</programlisting>
+
+ <para>
+ For other commands and help with <command>drbdadm</command>
+ see the DRBD documentation.
+ </para>
+
</section>
<section id="replication-drbd-install-drbd-othercfg">
- <title>Other DRBD Configuration Options</title>
+ <title>Additional DRBD Configuration Options</title>
<para>
Additional options you may want to configure:
@@ -976,20 +1146,141 @@
</section>
- <section id="replication-drbd-install-mysql">
+ </section>
- <title>Configuring MySQL for DRBD</title>
+ <section id="replication-drbd-install-mysql">
- <para>
- MySQL ....
- </para>
+ <title>Configuring MySQL for DRBD</title>
- </section>
+ <para>
+ Once you have configured DRBD and have an active DRBD device and
+ filesystem, you can configure MySQL to use the chosen device to
+ store the MySQL data.
+ </para>
+ <para>
+ When performing a new installation of MySQL, you can either
+ select to install MySQL entirely onto the DRBD device, or just
+ configure the data directory to be located on the new
+ filesystem.
+ </para>
+
+ <para>
+ In either case, the files and installation must take place on
+ the primary node, because that is the only DRBD node on which
+ you can mount the DRBD device filesystem as read/write.
+ </para>
+
+ <para>
+ You should store the following files and information on your
+ DRBD device:
+ </para>
+
+ <itemizedlist>
+
+ <listitem>
+ <para>
+ MySQL data files, including the binary log, and InnoDB data
+ files.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ MySQL configuration file (<filename>my.cnf</filename>).
+ </para>
+ </listitem>
+
+ </itemizedlist>
+
+ <para>
+ To setup MySQL to use your new DRBD device and filesystem:
+ </para>
+
+ <orderedlist>
+
+ <listitem>
+ <para>
+ If you are migrating an existing MySQL installation, stop
+ MySQL:
+ </para>
+
+<programlisting>$ mysqladmin shutdown</programlisting>
+ </listitem>
+
+ <listitem>
+ <para>
+ Copy the <filename>my.cnf</filename> onto the DRBD device.
+ If you are not already using a configuration file, copy one
+ of the sample configuration files from the MySQL
+ distribution.
+ </para>
+
+<programlisting># mkdir /mnt/drbd/mysql
+# cp /etc/my.cnf /mnt/drbd/mysql</programlisting>
+ </listitem>
+
+ <listitem>
+ <para>
+ Copy your MySQL data directory to the DRBD device and
+ mounted filesystem.
+ </para>
+
+<programlisting># cp -R /var/lib/mysql /drbd/mysql/data</programlisting>
+ </listitem>
+
+ <listitem>
+ <para>
+ Edit the configuration file to reflect the change of
+ directory by setting the value of the
+ <literal>datadir</literal> option. If you have not already
+ enabled the binary log, also set the value of the
+ <literal>log-bin</literal> option.
+ </para>
+
+<programlisting>datadir = /drbd/mysql/data
+ log-bin = mysql-bin</programlisting>
+ </listitem>
+
+ <listitem>
+ <para>
+ Create a symbolic link from <filename>/etc/my.cnf</filename>
+ to the new configuration file on the DRBD device filesystem.
+ </para>
+
+<programlisting># ln -s /drbd/mysql/my.cnf /etc/my.cnf</programlisting>
+ </listitem>
+
+ <listitem>
+ <para>
+ Now start MySQL and check that the data that you copied to
+ the DRBD device filesystem is present.
+ </para>
+
+<programlisting># /etc/init.d/mysql start</programlisting>
+ </listitem>
+
+ </orderedlist>
+
+ <para>
+ Your MySQL data should now be located on the filesystem running
+ on your DRBD device. The data will be physically stored on the
+ underlying device that you configured for the DRBD device.
+ Meanwhile, the content of your MySQL databases will be copied to
+ the secondary DRBD node.
+ </para>
+
+ <para>
+ Note that you cannot access the information on your secondary
+ node, as a DRBD device working in secondary mode is not
+ available for use.
+ </para>
+
</section>
</section>
+<!--
<section id="replication-drbd-performance">
<title>Optimizing Performance</title>
@@ -1019,5 +1310,6 @@
</para>
</section>
+ -->
</section>
| Thread |
|---|
| • svn commit - mysqldoc@docsrva: r7285 - trunk/refman-common | mcbrown | 31 Jul |