<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="replication-multi-source-monitoring">
      </a>
      19.1.5.8 Monitoring Multi-Source Replication
     </h4>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045145124352">
  </a>
  <a class="indexterm" name="idm46045145122848">
  </a>
  <p>
   To monitor the status of replication channels the following
      options exist:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      Using the replication Performance Schema tables. The first
          column of these tables is
      <code class="literal">
       Channel_Name
      </code>
      .
          This enables you to write complex queries based on
      <code class="literal">
       Channel_Name
      </code>
      as a key. See
      <a class="xref" href="performance-schema-replication-tables.html" title="29.12.11 Performance Schema Replication Tables">
       Section 29.12.11, “Performance Schema Replication Tables”
      </a>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      Using
      <code class="literal">
       SHOW REPLICA
          STATUS FOR CHANNEL
       <em class="replaceable">
        <code>
         channel
        </code>
       </em>
      </code>
      . By default, if
          the
      <code class="literal">
       FOR CHANNEL
       <em class="replaceable">
        <code>
         channel
        </code>
       </em>
      </code>
      clause is not
          used, this statement shows the replica status for all channels
          with one row per channel. The identifier
      <code class="literal">
       Channel_name
      </code>
      is added as a column in the
          result set. If a
      <code class="literal">
       FOR CHANNEL
       <em class="replaceable">
        <code>
         channel
        </code>
       </em>
      </code>
      clause is
          provided, the results show the status of only the named
          replication channel.
     </p>
    </li>
   </ul>
  </div>
  <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
   <div class="admon-title">
    Note
   </div>
   <p>
    The
    <a class="link" href="show-variables.html" title="15.7.7.41 SHOW VARIABLES Statement">
     <code class="literal">
      SHOW VARIABLES
     </code>
    </a>
    statement does
        not work with multiple replication channels. The information
        that was available through these variables has been migrated to
        the replication performance tables. Using a
    <a class="link" href="show-variables.html" title="15.7.7.41 SHOW VARIABLES Statement">
     <code class="literal">
      SHOW VARIABLES
     </code>
    </a>
    statement in a
        topology with multiple channels shows the status of only the
        default channel.
   </p>
  </div>
  <p>
   The error codes and messages that are issued when multi-source
      replication is enabled specify the channel that generated the
      error.
  </p>
  <div class="section">
   <div class="titlepage">
    <div>
     <div>
      <h5 class="title">
       <a name="replication-multi-source-monitoring-tutorial">
       </a>
       19.1.5.8.1 Monitoring Channels Using Performance Schema Tables
      </h5>
     </div>
    </div>
   </div>
   <a class="indexterm" name="idm46045145106896">
   </a>
   <p>
    This section explains how to use the replication Performance
        Schema tables to monitor channels. You can choose to monitor all
        channels, or a subset of the existing channels.
   </p>
   <p>
    To monitor the connection status of all channels:
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa96332465"><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 prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> replication_connection_status\G<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
CHANNEL_NAME<span class="token punctuation">:</span> source_1
GROUP_NAME<span class="token punctuation">:</span>
SOURCE_UUID<span class="token punctuation">:</span> 046e41f8-a223-11e4-a975-0811960cc264
THREAD_ID<span class="token punctuation">:</span> 24
SERVICE_STATE<span class="token punctuation">:</span> ON
COUNT_RECEIVED_HEARTBEATS<span class="token punctuation">:</span> 0
LAST_HEARTBEAT_TIMESTAMP<span class="token punctuation">:</span> 0000-00-00 00<span class="token punctuation">:</span>00<span class="token punctuation">:</span>00
RECEIVED_TRANSACTION_SET<span class="token punctuation">:</span> 046e41f8-a223-11e4-a975-0811960cc264<span class="token punctuation">:</span>4-37
LAST_ERROR_NUMBER<span class="token punctuation">:</span> 0
LAST_ERROR_MESSAGE<span class="token punctuation">:</span>
LAST_ERROR_TIMESTAMP<span class="token punctuation">:</span> 0000-00-00 00<span class="token punctuation">:</span>00<span class="token punctuation">:</span>00
<span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 2. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
CHANNEL_NAME<span class="token punctuation">:</span> source_2
GROUP_NAME<span class="token punctuation">:</span>
SOURCE_UUID<span class="token punctuation">:</span> 7475e474-a223-11e4-a978-0811960cc264
THREAD_ID<span class="token punctuation">:</span> 26
SERVICE_STATE<span class="token punctuation">:</span> ON
COUNT_RECEIVED_HEARTBEATS<span class="token punctuation">:</span> 0
LAST_HEARTBEAT_TIMESTAMP<span class="token punctuation">:</span> 0000-00-00 00<span class="token punctuation">:</span>00<span class="token punctuation">:</span>00
RECEIVED_TRANSACTION_SET<span class="token punctuation">:</span> 7475e474-a223-11e4-a978-0811960cc264<span class="token punctuation">:</span>4-6
LAST_ERROR_NUMBER<span class="token punctuation">:</span> 0
LAST_ERROR_MESSAGE<span class="token punctuation">:</span>
LAST_ERROR_TIMESTAMP<span class="token punctuation">:</span> 0000-00-00 00<span class="token punctuation">:</span>00<span class="token punctuation">:</span>00
</span><span class="token output">2 rows in set (0.00 sec)</span></code></pre>
   </div>
   <p>
    In the above output there are two channels enabled, and as shown
        by the
    <code class="literal">
     CHANNEL_NAME
    </code>
    field they are called
    <code class="literal">
     source_1
    </code>
    and
    <code class="literal">
     source_2
    </code>
    .
   </p>
   <p>
    The addition of the
    <code class="literal">
     CHANNEL_NAME
    </code>
    field
        enables you to query the Performance Schema tables for a
        specific channel. To monitor the connection status of a named
        channel, use a
    <code class="literal">
     WHERE
        CHANNEL_NAME=
     <em class="replaceable">
      <code>
       channel
      </code>
     </em>
    </code>
    clause:
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa97781543"><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 prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> replication_connection_status <span class="token keyword">WHERE</span> CHANNEL_NAME<span class="token operator">=</span><span class="token string">'source_1'</span>\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
CHANNEL_NAME<span class="token punctuation">:</span> source_1
GROUP_NAME<span class="token punctuation">:</span>
SOURCE_UUID<span class="token punctuation">:</span> 046e41f8-a223-11e4-a975-0811960cc264
THREAD_ID<span class="token punctuation">:</span> 24
SERVICE_STATE<span class="token punctuation">:</span> ON
COUNT_RECEIVED_HEARTBEATS<span class="token punctuation">:</span> 0
LAST_HEARTBEAT_TIMESTAMP<span class="token punctuation">:</span> 0000-00-00 00<span class="token punctuation">:</span>00<span class="token punctuation">:</span>00
RECEIVED_TRANSACTION_SET<span class="token punctuation">:</span> 046e41f8-a223-11e4-a975-0811960cc264<span class="token punctuation">:</span>4-37
LAST_ERROR_NUMBER<span class="token punctuation">:</span> 0
LAST_ERROR_MESSAGE<span class="token punctuation">:</span>
LAST_ERROR_TIMESTAMP<span class="token punctuation">:</span> 0000-00-00 00<span class="token punctuation">:</span>00<span class="token punctuation">:</span>00
</span><span class="token output">1 row in set (0.00 sec)</span></code></pre>
   </div>
   <p>
    Similarly, the
    <code class="literal">
     WHERE
        CHANNEL_NAME=
     <em class="replaceable">
      <code>
       channel
      </code>
     </em>
    </code>
    clause
        can be used to monitor the other replication Performance Schema
        tables for a specific channel. For more information, see
    <a class="xref" href="performance-schema-replication-tables.html" title="29.12.11 Performance Schema Replication Tables">
     Section 29.12.11, “Performance Schema Replication Tables”
    </a>
    .
   </p>
  </div>
 </div>
 <br/>
</div>
