List:Commits« Previous MessageNext Message »
From:mcbrown Date:February 1 2007 2:29pm
Subject:svn commit - mysqldoc@docsrva: r4731 - branches/repupdate/5.1
View as plain text  
Author: mcbrown
Date: 2007-02-01 15:29:05 +0100 (Thu, 01 Feb 2007)
New Revision: 4731

Log:
Interim commit with extended structure and (some) completed content



Modified:
   branches/repupdate/5.1/replication.xml


Modified: branches/repupdate/5.1/replication.xml
===================================================================
--- branches/repupdate/5.1/replication.xml	2007-02-01 13:19:53 UTC (rev 4730)
+++ branches/repupdate/5.1/replication.xml	2007-02-01 14:29:05 UTC (rev 4731)
Changed blocks: 9, Lines Added: 329, Lines Deleted: 19; 14392 bytes

@@ -165,22 +165,129 @@
     <title>Replication Configuration</title>
 
     <para>
-      Replication works through the use of the binary log on the master.
-      On the master, statements and updates are written to the binary
-      log. Slaves connect to the master and process the recorded
-      statements and changes listed in the binary log from a specific
-      position within the binary log.
+      Replication between servers in MySQL works through the use of the
+      binary logging mechanism. The MySQL instance operating as the
+      master (the source of the database changes) writes updates and
+      changes to the database to the binary log. The information in the
+      binary log is stored in different logging formats according to the
+      statements database changes being recorded. Slaves are configured
+      to read the binary log from the master and to execute the events
+      in the binary log on the slave's local database.
     </para>
 
     <para>
-      Because each slave keeps a record of the current location within
-      the master binary log, you can have multiple slaves reading from
-      the binary log simultaneously. Also, because slaves are
-      responsible for reading from the correct position in the binary
-      log of the master, slaves can be connected and disconnected from
-      the slave at will.
+      The Master is dumb in this scenario. Once binary logging has been
+      enabled, all statements are recorded in the binary log. Each slave
+      will receive a copy of the entire contents of the binary log. It
+      is the responsibility of the slave to decide which statements in
+      the binary log should be executed; you cannot configure the master
+      to log only certain events. If you do not specify otherwise, all
+      events in the master binary log are executed on the slave. If
+      required, you can configure the slave to only process events that
+      apply to particular databases or tables.
     </para>
 
+    <para>
+      Slaves keep a record of the binary log file and position within
+      the log file that they have read and processed from the master.
+      This means that multiple slaves can be connected to the master and
+      executing different parts of the same binary log. Because the
+      slaves control this process, individual slaves can be connected
+      and disconnected from the server without affecting master's
+      operation. Also, because the slaves remember their position, it is
+      possible for slaves to be disconnected, reconnect and then 'catch
+      up' with eaiting events in the master's binary log.
+    </para>
+
+    <para>
+      Configuration of the replication process relies on configuration
+      options on the master and slave through the
+      <filename>my.cnf</filename> or <filename>my.ini</filename> file.
+      On the master, the key configuration options are:
+    </para>
+
+    <itemizedlist>
+
+      <listitem>
+        <para>
+          <literal>log-bin</literal> &mdash; this enables the binary
+          logging. Without enabling binary logging, replication is
+          impossible.
+        </para>
+      </listitem>
+
+      <listitem>
+        <para>
+          <literal>server-id</literal> &mdash; each MySQL server in the
+          replication group must have a unique ID.
+        </para>
+      </listitem>
+
+    </itemizedlist>
+
+    <para>
+      Each slave must also be configured with a unique id (using the
+      <literal>server-id</literal> option). In addition, the slave must
+      be configured with information about the master host name, log
+      file name and position within that file. These details can be
+      controlled from within a MySQL session using the <literal>CHANGE
+      MASTER</literal> statement. The details are stored withing the
+      <filename>master.info</filename> file.
+    </para>
+
+    <para>
+      Once replication is configured and setup it should require very
+      little administration or monitoring.
+    </para>
+
+    <para>
+      In this section the setup and configuration of your replication
+      environment is described in detail. The major components of this
+      section are:
+    </para>
+
+    <itemizedlist>
+
+      <listitem>
+        <para>
+          For a guide to setting up two or more servers for replication
+          see <xref linkend="replication-howto"/>. This section deals
+          with the setup of the systems and provides methods for copying
+          data between the master and slaves.
+        </para>
+      </listitem>
+
+      <listitem>
+        <para>
+          Binary logging is recorded using a number of formats. These
+          are referred to as statement based replication (SBR) or row
+          based replication (RBR). A third type, mixed-format
+          replication (MIXED), uses SBR or RBR replication according to
+          the statements and/or user choice. The different formats are
+          discussed in <xref
+linkend="replication-formats"/>.
+        </para>
+      </listitem>
+
+      <listitem>
+        <para>
+          Detailed information on the different configuration options
+          available is provided in
+          <xref linkend="replication-options"/>.
+        </para>
+      </listitem>
+
+      <listitem>
+        <para>
+          Once started, the replication process should require little
+          administration or monitoring. However, for advice on common
+          tasks that you may want to executed, see
+          <xref linkend="replication-administration"/>.
+        </para>
+      </listitem>
+
+    </itemizedlist>
+
     <section id="replication-howto">
 
       <title>How to Set Up Replication</title>

@@ -194,13 +301,85 @@
       </para>
 
       <para>
-        To help you choose:
+        There are some generic tasks which may be required for all
+        replication setups:
       </para>
 
       <itemizedlist>
 
         <listitem>
           <para>
+            You may want to create a separate user that will be used by
+            your slaves to authenticate with the master to read the
+            binary log for replication. The step is optional. See
+            <xref linkend="replication-howto-repuser"/>.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            You must configure the master to support the binary log and
+            configure a unique ID. See
+            <xref
+    linkend="replication-howto-masterbaseconfig"/>.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            You must configure a unique ID for each slave that you want
+            to connect to the Master. See
+            <xref
+    linkend="replication-howto-slavebaseconfig"/>.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            Before starting a data snapshot or the replication process,
+            you should record the position of the binary log on the
+            master. You will need this information when configuring the
+            slave so that the slave knows where within the binary log to
+            start executing events. See
+            <xref
+      linkend="replication-howto-masterstatus"/>.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            If you already have data on your Master and you want to
+            syncronize your slave with this base data, then you will
+            need to create a data snapshot of your database. You can
+            create a snapshot using <literal>mysqldump</literal> (see
+            <xref
+    linkend="replication-howto-mysqldump"/>) or by
+            copying the data files directly (see
+            <xref linkend="replication-howto-archive"/>.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>
+            You will need to configure the slave with the Master
+            settings, such as the hostname, login credentials and binary
+            log name and positions. See
+            <xref linkend="replication-howto-slaveinit"/>.
+          </para>
+        </listitem>
+
+      </itemizedlist>
+
+      <para>
+        Once you have configured the basic options, you will need to
+        follow the instructions for your replication setup. A number of
+        alternatives are provided:
+      </para>
+
+      <itemizedlist>
+
+        <listitem>
+          <para>
             If you are setting up a new MySQL master and one or more
             slaves, then you need only setup up the configuration, as
             you have no data to exchange. For guidance on setting up

@@ -249,14 +428,111 @@
         described in <xref linkend="replication-options"/>.
       </para>
 
+      <section id="replication-howto-repuser">
+
+        <title>Creating a User For Replication</title>
+
+        <para>
+          Each Slave must connect to the Master using a standard
+          username and password. The user that you use for this
+          operation can be any user, providing they have been granted
+          the <literal>REPLICATION</literal> privilege.
+        </para>
+
+        <para>
+          You do not need to create a specific user for replication.
+          However, you should be aware that the username and password
+          will be stored in plaintext within the
+          <literal>master.info</literal> file. Therefore you may want to
+          create a user that only has privileges for the replication
+          process.
+        </para>
+
+        <para>
+          To create a user or grant an existing user the privileges
+          required for replication use the <literal>GRANT</literal>
+          statement:
+        </para>
+
+<programlisting>mysql&gt; GRANT REPLICATION SLAVE ON *.*
+    -&gt; TO 'repl'@'%.mydomain.com' IDENTIFIED BY 'slavepass';</programlisting>
+
+      </section>
+
+      <section id="replication-howto-masterbaseconfig">
+
+        <title>Setting the Replication Master Configuration</title>
+
+        <para>
+          For replication to work you <emphasis>must</emphasis> enable
+          binary logging on the master. If binary logging is not
+          enabled, replication will not be possible as it is the binary
+          log that is used to exchange data between the master and
+          slaves.
+        </para>
+
+        <para>
+          When you enable binary logging, all statements on the server
+          are recorded in the binary log. When a slave connects to the
+          master, it reads the entire contents of the binary log and
+          executes the events within the log
+        </para>
+
+      </section>
+
+      <section id="replication-howto-slavebaseconfig">
+
+        <title>Setting the Replication Slave Configuration</title>
+
+      </section>
+
+      <section id="replication-howto-masterstatus">
+
+        <title>Obtaining the Master Replication Information</title>
+
+      </section>
+
+      <section id="replication-howto-mysqldump">
+
+        <title>Creating a Data Snapshot using <literal>mysqldump</literal></title>
+
+        <para>
+          One way to create a snapshot of the data in an existing Master
+          database is to use the <literal>mysqldump</literal> tool.
+        </para>
+
+      </section>
+
+      <section id="replication-howto-rawdata">
+
+        <title>Creating a Data Snapshot Raw Data Files</title>
+
+      </section>
+
+      <section id="replication-howto-slaveinit">
+
+        <title>Setting the Master Configuration on the Slave</title>
+
+      </section>
+
       <section id="replication-howto-newservers">
 
-        <title>Setting up replication with new Master and Slaves</title>
+        <title>Setting up Replication with new Master and Slaves</title>
 
         <para>
-          TODO
+          Setting up replication with a new Master and Slaves (i.e. with
+          no existing data) is the easiest and most straightforward
+          method for setting up replication.
         </para>
 
+        <para>
+          You can also this method if you are setting up new servers and
+          have an existing dump of the databases that you want to load
+          into your replication configuration. By loading the data onto
+          a new master, the data will be automatically replicated to the
+          slaves.
+        </para>
+
       </section>
 
       <section id="replication-howto-existingdata">

@@ -2955,6 +3231,22 @@
 
     <title>Replication Topologies</title>
 
+    <para>
+      MySQL supports many different topologies for replication. Which
+      topology you use will depend on your requirements and what you
+      want to use replication to achieve.
+    </para>
+
+    <itemizedlist>
+
+      <listitem>
+        <para>
+          <emphasis role="bold">Single slave</emphasis>
+        </para>
+      </listitem>
+
+    </itemizedlist>
+
     <section id="replication-topology-single-slave">
 
       <title>Replication with a Single Slave</title>

@@ -3114,7 +3406,7 @@
 
     <section id="replication-topology-circular">
 
-      <title>Replication with Multiple Masters (Circular)</title>
+      <title>Replication with Circular Masters</title>
 
       <para>
         Multiple masters

@@ -3191,6 +3483,12 @@
 
     </section>
 
+    <section id="replication-topology-multimaster-toone">
+
+      <title>Replicating Multiple Masters to One Slave</title>
+
+    </section>
+
   </section>
 
   <section id="replication-solutions">

@@ -3207,6 +3505,12 @@
 
     </section>
 
+    <section>
+
+      <title>Using Replication with different Master and Slave Engines</title>
+
+    </section>
+
     <section id="replication-solutions-scaleout">
 
       <title>Using Replication for Scale-out</title>

@@ -3261,9 +3565,7 @@
 
       <title>Improving Replication Performance</title>
 
-      <para>
-        For completion.
-      </para>
+      <para></para>
 
       <figure id="figure-replication-performance">
         <title>Using an additional replication host to improve performance</title>

@@ -3479,9 +3781,17 @@
       <title>Setting up replication using SSL</title>
 
       <para>
-        TODO
+        To use SSL for encrypting the transfer of the binary log
+        required during replication
       </para>
 
+      <para>
+        On the master, you must set the SSL specific master
+        configuration parameters. For example:
+      </para>
+
+<programlisting></programlisting>
+
     </section>
 
   </section>


Thread
svn commit - mysqldoc@docsrva: r4731 - branches/repupdate/5.1mcbrown1 Feb