<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="replication-howto-masterbaseconfig">
      </a>
      19.1.2.1 Setting the Replication Source Configuration
     </h4>
    </div>
   </div>
  </div>
  <p>
   To configure a source to use binary log file position based
        replication, you must ensure that binary logging is enabled, and
        establish a unique server ID.
  </p>
  <p>
   Each server within a replication topology must be configured
        with a unique server ID, which you can specify using the
   <a class="link" href="replication-options.html#sysvar_server_id">
    <code class="literal">
     server_id
    </code>
   </a>
   system variable. This
        server ID is used to identify individual servers within the
        replication topology, and must be a positive integer between 1
        and (2
   <sup>
    32
   </sup>
   )−1. 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 this at runtime by issuing a statement like this one:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa20217184"><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">2</span><span class="token punctuation">;</span></code></pre>
  </div>
  <p>
   Organization and selection of the server IDs is arbitrary, as
        long as each server ID is different from every other server ID
        in use by any other server in the replication topology. Note
        that if a value of 0 was set previously for the server ID, you
        must restart the server to initialize the source 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.
  </p>
  <p>
   Binary logging is required on the source because the binary log
        is the basis for replicating changes from the source to its
        replicas. Binary logging is enabled by default (the
   <a class="link" href="replication-options-binary-log.html#sysvar_log_bin">
    <code class="literal">
     log_bin
    </code>
   </a>
   system variable is set
        to ON). The
   <a class="link" href="replication-options-binary-log.html#option_mysqld_log-bin">
    <code class="option">
     --log-bin
    </code>
   </a>
   option
        tells the server what base name to use for binary log files. It
        is recommended that you specify this option to give the binary
        log files a non-default base name, so that if the host name
        changes, you can easily continue to use the same binary log file
        names (see
   <a class="xref" href="known-issues.html" title="B.3.7 Known Issues in MySQL">
    Section B.3.7, “Known Issues in MySQL”
   </a>
   ). If binary logging
        was previously disabled on the source using the
   <a class="link" href="replication-options-binary-log.html#option_mysqld_log-bin">
    <code class="option">
     --skip-log-bin
    </code>
   </a>
   option, you must restart the server without this option to
        enable it.
  </p>
  <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
   <div class="admon-title">
    Note
   </div>
   <p>
    The following options also have an impact on the source:
   </p>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       For the greatest possible durability and consistency in a
              replication setup using
       <a class="link" href="innodb-storage-engine.html" title="Chapter 17 The InnoDB Storage Engine">
        <code class="literal">
         InnoDB
        </code>
       </a>
       with transactions, you
              should use
       <code class="literal">
        innodb_flush_log_at_trx_commit=1
       </code>
       and
       <code class="literal">
        sync_binlog=1
       </code>
       in the source's
       <code class="filename">
        my.cnf
       </code>
       file.
      </p>
     </li>
     <li class="listitem">
      <p>
       Ensure that the
       <a class="link" href="server-system-variables.html#sysvar_skip_networking">
        <code class="literal">
         skip_networking
        </code>
       </a>
       system
              variable is not enabled on the source. If networking has
              been disabled, the replica cannot communicate with the
              source and replication fails.
      </p>
     </li>
    </ul>
   </div>
  </div>
 </div>
 <br/>
</div>
