<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="replication-howto-slavebaseconfig">
      </a>
      19.1.2.2 Setting the Replica Configuration
     </h4>
    </div>
   </div>
  </div>
  <p>
   Each replica must have a unique server ID, as specified by the
   <a class="link" href="replication-options.html#sysvar_server_id">
    <code class="literal">
     server_id
    </code>
   </a>
   system variable. If
        you are setting up multiple replicas, each one must have a
        unique
   <a class="link" href="replication-options.html#sysvar_server_id">
    <code class="literal">
     server_id
    </code>
   </a>
   value that
        differs from that of the source and from any of the other
        replicas. If the replica's server ID is not already set, or the
        current value conflicts with the value that you have chosen for
        the source or another replica, you must change it.
  </p>
  <p>
   The default
   <a class="link" href="replication-options.html#sysvar_server_id">
    <code class="literal">
     server_id
    </code>
   </a>
   value is
        1. You can change the
   <a class="link" href="replication-options.html#sysvar_server_id">
    <code class="literal">
     server_id
    </code>
   </a>
   value dynamically by issuing a statement like this:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa94491431"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SET</span> <span class="token keyword">GLOBAL</span> server_id <span class="token operator">=</span> <span class="token number">21</span><span class="token punctuation">;</span></code></pre>
  </div>
  <p>
   Note that a value of 0 for the server ID prevents a replica from
        connecting to a source. If that server ID value (which was the
        default in earlier releases) was set previously, you must
        restart the server to initialize the replica with your new
        nonzero server ID. Otherwise, a server restart is not needed
        when you change the server ID, unless you make other
        configuration changes that require it. For example, if binary
        logging was disabled on the server and you want it enabled for
        your replica, a server restart is required to enable this.
  </p>
  <p>
   If you are shutting down the replica server, you can edit the
   <code class="literal">
    [mysqld]
   </code>
   section of the configuration file to
        specify a unique server ID. For example:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-ini"><div class="docs-select-all right" id="sa33631440"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-ini"><span class="token selector">[mysqld]</span>
<span class="token constant">server-id</span><span class="token attr-value"><span class="token punctuation">=</span>21</span></code></pre>
  </div>
  <p>
   Binary logging is enabled by default on all servers. A replica
        is not required to have binary logging enabled for replication
        to take place. However, binary logging on a replica means that
        the replica's binary log can be used for data backups and crash
        recovery. Replicas that have binary logging enabled can also be
        used as part of a more complex replication topology. For
        example, you might want to set up replication servers using this
        chained arrangement:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting one-line language-none"><div class="docs-select-all right" id="sa53971854"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">A -&gt; B -&gt; C</code></pre>
  </div>
  <p>
   Here,
   <code class="literal">
    A
   </code>
   serves as the source for the replica
   <code class="literal">
    B
   </code>
   , and
   <code class="literal">
    B
   </code>
   serves as the
        source for the replica
   <code class="literal">
    C
   </code>
   . For this to work,
   <code class="literal">
    B
   </code>
   must be both a source
   <span class="emphasis">
    <em>
     and
    </em>
   </span>
   a replica. Updates received from
   <code class="literal">
    A
   </code>
   must be logged by
   <code class="literal">
    B
   </code>
   to
        its binary log, in order to be passed on to
   <code class="literal">
    C
   </code>
   . In addition to binary logging, this
        replication topology requires the system variable
   <a class="link" href="replication-options-binary-log.html#sysvar_log_replica_updates">
    <code class="literal">
     log_replica_updates
    </code>
   </a>
   to be
        enabled. With replica updates enabled, the replica writes
        updates that are received from a source and performed by the
        replica's SQL thread to the replica's own binary log.
   <code class="literal">
    log_replica_updates
   </code>
   is enabled by default.
  </p>
  <p>
   If you need to disable binary logging or replica update logging
        on a replica, you can do this by specifying the
   <a class="link" href="replication-options-binary-log.html#option_mysqld_log-bin">
    <code class="option">
     --skip-log-bin
    </code>
   </a>
   and
   <a class="link" href="replication-options-binary-log.html#sysvar_log_replica_updates">
    <code class="option">
     --log-replica-updates=OFF
    </code>
   </a>
   options for the replica. If you decide to re-enable these
        features on the replica, remove the relevant options and restart
        the server.
  </p>
 </div>
 <br/>
</div>
