<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="replication-threads-monitor-main">
      </a>
      19.2.3.1 Monitoring Replication Main Threads
     </h4>
    </div>
   </div>
  </div>
  <p>
   The
   <a class="link" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
    <code class="literal">
     SHOW PROCESSLIST
    </code>
   </a>
   statement
        provides information that tells you what is happening on the
        source and on the replica regarding replication. For information
        on source states, see
   <a class="xref" href="source-thread-states.html" title="10.14.4 Replication Source Thread States">
    Section 10.14.4, “Replication Source Thread States”
   </a>
   .
        For replica states, see
   <a class="xref" href="replica-io-thread-states.html" title="10.14.5 Replication I/O (Receiver) Thread States">
    Section 10.14.5, “Replication I/O (Receiver) Thread States”
   </a>
   , and
   <a class="xref" href="replica-sql-thread-states.html" title="10.14.6 Replication SQL Thread States">
    Section 10.14.6, “Replication SQL Thread States”
   </a>
   .
  </p>
  <p>
   The following example illustrates how the three main replication
        threads, the binary log dump thread, replication I/O (receiver)
        thread, and replication SQL (applier) thread, show up in the
        output from
   <a class="link" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
    <code class="literal">
     SHOW PROCESSLIST
    </code>
   </a>
   .
  </p>
  <p>
   On the source server, the output from
   <a class="link" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
    <code class="literal">
     SHOW
        PROCESSLIST
    </code>
   </a>
   looks like this:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa53453033"><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">SHOW</span> <span class="token keyword">PROCESSLIST</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>
     Id<span class="token punctuation">:</span> 2
   User<span class="token punctuation">:</span> root
   Host<span class="token punctuation">:</span> localhost<span class="token punctuation">:</span>32931
     db<span class="token punctuation">:</span> NULL
Command<span class="token punctuation">:</span> Binlog Dump
   Time<span class="token punctuation">:</span> 94
  State<span class="token punctuation">:</span> Has sent all binlog to slave; waiting for binlog to
         be updated
   Info<span class="token punctuation">:</span> NULL</span></code></pre>
  </div>
  <p>
   Here, thread 2 is a
   <code class="literal">
    Binlog Dump
   </code>
   thread that
        services a connected replica. The
   <code class="literal">
    State
   </code>
   information indicates that all outstanding updates have been
        sent to the replica and that the source is waiting for more
        updates to occur. If you see no
   <code class="literal">
    Binlog Dump
   </code>
   threads on a source server, this means that replication is not
        running; that is, no replicas are currently connected.
  </p>
  <p>
   On a replica server, the output from
   <a class="link" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
    <code class="literal">
     SHOW
        PROCESSLIST
    </code>
   </a>
   looks like this:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa82414362"><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">SHOW</span> <span class="token keyword">PROCESSLIST</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>
     Id<span class="token punctuation">:</span> 10
   User<span class="token punctuation">:</span> system user
   Host<span class="token punctuation">:</span>
     db<span class="token punctuation">:</span> NULL
Command<span class="token punctuation">:</span> Connect
   Time<span class="token punctuation">:</span> 11
  State<span class="token punctuation">:</span> Waiting for master to send event
   Info<span class="token punctuation">:</span> NULL
<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>
     Id<span class="token punctuation">:</span> 11
   User<span class="token punctuation">:</span> system user
   Host<span class="token punctuation">:</span>
     db<span class="token punctuation">:</span> NULL
Command<span class="token punctuation">:</span> Connect
   Time<span class="token punctuation">:</span> 11
  State<span class="token punctuation">:</span> Has read all relay log; waiting for the slave I/O
         thread to update it
   Info<span class="token punctuation">:</span> NULL</span></code></pre>
  </div>
  <p>
   The
   <code class="literal">
    State
   </code>
   information indicates that thread
        10 is the replication I/O (receiver) thread that is
        communicating with the source server, and thread 11 is the
        replication SQL (applier) thread that is processing the updates
        stored in the relay logs. At the time that
   <a class="link" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
    <code class="literal">
     SHOW PROCESSLIST
    </code>
   </a>
   was run, both
        threads were idle, waiting for further updates.
  </p>
  <p>
   The value in the
   <code class="literal">
    Time
   </code>
   column can show how
        late the replica is compared to the source. See
   <a class="xref" href="faqs-replication.html" title="A.14 MySQL 8.4 FAQ: Replication">
    Section A.14, “MySQL 8.4 FAQ: Replication”
   </a>
   . If sufficient time elapses
        on the source side without activity on the
   <code class="literal">
    Binlog
        Dump
   </code>
   thread, the source determines that the replica is
        no longer connected. As for any other client connection, the
        timeouts for this depend on the values of
   <code class="option">
    net_write_timeout
   </code>
   and
   <code class="option">
    net_retry_count
   </code>
   ; for more information about
        these, see
   <a class="xref" href="server-system-variables.html" title="7.1.8 Server System Variables">
    Section 7.1.8, “Server System Variables”
   </a>
   .
  </p>
  <p>
   The
   <a class="link" href="show-replica-status.html" title="15.7.7.35 SHOW REPLICA STATUS Statement">
    <code class="literal">
     SHOW REPLICA STATUS
    </code>
   </a>
   statement
        provides additional information about replication processing on
        a replica server. See
   <a class="xref" href="replication-administration-status.html" title="19.1.7.1 Checking Replication Status">
    Section 19.1.7.1, “Checking Replication Status”
   </a>
   .
  </p>
  <p>
   You can also retrieve information on the source's
   <code class="literal">
    Binlog Dump
   </code>
   threads with the following:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa2700930"><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">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> performance_schema<span class="token punctuation">.</span>threads <span class="token keyword">WHERE</span> PROCESSLIST_COMMAND <span class="token operator">LIKE</span> <span class="token string">"Binlog Dump%"</span></code></pre>
  </div>
  <p>
   <code class="literal">
    Binlog Dump%
   </code>
   is used to retrieve either
   <code class="literal">
    Binlog Dump
   </code>
   or
   <code class="literal">
    Binlog Dump
        GTID
   </code>
   , depending on which mode binlog dumping is in.
  </p>
 </div>
 <br/>
</div>
