<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h3 class="title">
      <a name="group-replication-enterprise-backup">
      </a>
      20.5.6 Using MySQL Enterprise Backup with Group Replication
     </h3>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045132831264">
  </a>
  <a class="indexterm" name="idm46045132829776">
  </a>
  <p>
   <a class="link" href="mysql-enterprise-backup.html" title="32.1 MySQL Enterprise Backup Overview">
    MySQL Enterprise Backup
   </a>
   is a
      commercially-licensed backup utility for MySQL Server, available
      with
   <a class="ulink" href="https://www.mysql.com/products/enterprise/" target="_blank">
    MySQL Enterprise Edition
   </a>
   .
      This section explains how to back up and subsequently restore a
      Group Replication member using MySQL Enterprise Backup. The same technique can be
      used to quickly add a new member to a group.
  </p>
  <h4>
   <a name="idm46045132826080">
   </a>
   Backing up a Group Replication Member Using MySQL Enterprise Backup
  </h4>
  <p>
   Backing up a Group Replication member is similar to backing up a
      stand-alone MySQL instance. The following instructions assume that
      you are already familiar with how to use MySQL Enterprise Backup to perform a
      backup; if that is not the case, please review
   <a class="ulink" href="/doc/mysql-enterprise-backup/8.4/en/backing-up.html" target="_top">
    Backing Up a Database Server
   </a>
   . Also note the requirements described
      in
   <a class="ulink" href="/doc/mysql-enterprise-backup/8.4/en/mysqlbackup.privileges.html" target="_top">
    Grant MySQL Privileges to Backup Administrator
   </a>
   and
   <a class="ulink" href="/doc/mysql-enterprise-backup/8.4/en/meb-group-replication.html" target="_top">
    Using MySQL Enterprise Backup with Group Replication
   </a>
   .
  </p>
  <p>
   Consider the following group with three members,
   <code class="literal">
    s1
   </code>
   ,
   <code class="literal">
    s2
   </code>
   , and
   <code class="literal">
    s3
   </code>
   , running on hosts with the same names:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa10563960"><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> member_host<span class="token punctuation">,</span> member_port<span class="token punctuation">,</span> member_state <span class="token keyword">FROM</span> performance_schema<span class="token punctuation">.</span>replication_group_members<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><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> member_host <span class="token punctuation">|</span> member_port <span class="token punctuation">|</span> member_state <span class="token punctuation">|</span></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><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> s1          <span class="token punctuation">|</span>        3306 <span class="token punctuation">|</span> ONLINE       <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> s2          <span class="token punctuation">|</span>        3306 <span class="token punctuation">|</span> ONLINE       <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> s3          <span class="token punctuation">|</span>        3306 <span class="token punctuation">|</span> ONLINE       <span class="token punctuation">|</span></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><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
  </div>
  <p>
   Using MySQL Enterprise Backup, create a backup of
   <code class="literal">
    s2
   </code>
   by issuing
      on its host, for example, the following command:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa55389885"><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-terminal">s2&gt; mysqlbackup <span class="token constant">--defaults-file</span><span class="token attr-value"><span class="token punctuation">=</span>/etc/my.cnf</span> <span class="token constant">--backup-image</span><span class="token attr-value"><span class="token punctuation">=</span>/backups/my.mbi_`date</span> +%d%m_%H%M` \
		      <span class="token constant">--backup-dir</span><span class="token attr-value"><span class="token punctuation">=</span>/backups/backup_`date</span> +%d%m_%H%M` <span class="token constant">--user</span><span class="token attr-value"><span class="token punctuation">=</span>root</span> <span class="token property">-p</span> \
<span class="token constant">--host</span><span class="token attr-value"><span class="token punctuation">=</span>127.0.0.1</span> backup-to-image</code></pre>
  </div>
  <h4>
   <a name="group-replication-restore-failed-member">
   </a>
   Restoring a Failed Member
  </h4>
  <p>
   Assume one of the members (
   <code class="literal">
    s3
   </code>
   in the following
      example) is irreconcilably corrupted. The most recent backup of
      group member
   <code class="literal">
    s2
   </code>
   can be used to restore
   <code class="literal">
    s3
   </code>
   . Here are the steps for performing the
      restore:
  </p>
  <div class="orderedlist">
   <ol class="orderedlist" type="1">
    <li class="listitem">
     <p>
      <span class="emphasis">
       <em>
        Copy the backup of s2 onto the host for
          s3.
       </em>
      </span>
      The exact way to copy the backup depends on the
          operating system and tools available to you. In this example,
          we assume the hosts are both Linux servers and use SCP to copy
          the files between them:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa37970269"><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-terminal">s2/backups&gt; scp my<span class="token punctuation">.</span>mbi_2206_1429 s3<span class="token punctuation">:</span>/backups</code></pre>
     </div>
    </li>
    <li class="listitem">
     <p>
      <span class="emphasis">
       <em>
        Restore the backup.
       </em>
      </span>
      Connect to the target
          host (the host for
      <code class="literal">
       s3
      </code>
      in this case), and
          restore the backup using MySQL Enterprise Backup. Here are the steps:
     </p>
     <div class="orderedlist">
      <ol class="orderedlist" type="a">
       <li class="listitem">
        <p>
         Stop the corrupted server, if it is still running. For
              example, on Linux distributions that use systemd:
        </p>
        <div class="copytoclipboard-wrapper">
         <pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa30376371"><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-simple">s3<span class="token operator">&gt;</span> systemctl stop mysqld</code></pre>
        </div>
       </li>
       <li class="listitem">
        <p>
         Preserve the two configuration files in the corrupted
              server's data directory,
         <code class="filename">
          auto.cnf
         </code>
         and
         <code class="filename">
          mysqld-auto.cnf
         </code>
         (if it exists), by
              copying them to a safe location outside of the data
              directory. This is for preserving the
         <a class="link" href="replication-options.html#sysvar_server_uuid">
          server's UUID
         </a>
         and
         <a class="xref" href="persisted-system-variables.html" title="7.1.9.3 Persisted System Variables">
          Section 7.1.9.3, “Persisted System Variables”
         </a>
         (if
              used), which are needed in the steps below.
        </p>
       </li>
       <li class="listitem">
        <p>
         Delete all contents in the data directory of
         <code class="literal">
          s3
         </code>
         . For example:
        </p>
        <div class="copytoclipboard-wrapper">
         <pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa69151254"><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-terminal">s3&gt; rm <span class="token property">-rf</span> /var/lib/mysql/*</code></pre>
        </div>
        <p>
         If the system variables
         <a class="link" href="innodb-parameters.html#sysvar_innodb_data_home_dir">
          <code class="literal">
           innodb_data_home_dir
          </code>
         </a>
         ,
         <a class="link" href="innodb-parameters.html#sysvar_innodb_log_group_home_dir">
          <code class="literal">
           innodb_log_group_home_dir
          </code>
         </a>
         ,
              and
         <a class="link" href="innodb-parameters.html#sysvar_innodb_undo_directory">
          <code class="literal">
           innodb_undo_directory
          </code>
         </a>
         point to any directories other than the data directory,
              they should also be made empty; otherwise, the restore
              operation fails.
        </p>
       </li>
       <li class="listitem">
        <p>
         Restore backup of
         <code class="literal">
          s2
         </code>
         onto the host for
         <code class="literal">
          s3
         </code>
         :
        </p>
        <div class="copytoclipboard-wrapper">
         <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa65955596"><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-terminal">s3&gt; mysqlbackup <span class="token constant">--defaults-file</span><span class="token attr-value"><span class="token punctuation">=</span>/etc/my.cnf</span> \
  <span class="token constant">--datadir</span><span class="token attr-value"><span class="token punctuation">=</span>/var/lib/mysql</span> \
  <span class="token constant">--backup-image</span><span class="token attr-value"><span class="token punctuation">=</span>/backups/my.mbi_2206_1429</span>  \
<span class="token constant">--backup-dir</span><span class="token attr-value"><span class="token punctuation">=</span>/tmp/restore_`date</span> +%d%m_%H%M` copy-back-and-apply-log</code></pre>
        </div>
        <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
         <div class="admon-title">
          Note
         </div>
         <p>
          The command above assumes that the binary logs and relay
                logs on
          <code class="literal">
           s2
          </code>
          and
          <code class="literal">
           s3
          </code>
          have the same base name and are at the same location on
                the two servers. If these conditions are not met, you
                should use the
          <a class="ulink" href="/doc/mysql-enterprise-backup/8.4/en/server-repository-options.html#option_meb_log-bin" target="_top">
           <code class="option">
            --log-bin
           </code>
          </a>
          and
          <a class="ulink" href="/doc/mysql-enterprise-backup/8.4/en/server-repository-options.html#option_meb_relay-log" target="_top">
           <code class="option">
            --relay-log
           </code>
          </a>
          options to
                restore the binary log and relay log to their original
                file paths on
          <code class="literal">
           s3
          </code>
          . For example, if you
                know that on
          <code class="literal">
           s3
          </code>
          the binary log's base
                name is
          <code class="literal">
           s3-bin
          </code>
          and the relay-log's
                base name is
          <code class="literal">
           s3-relay-bin
          </code>
          , your
                restore command should look like:
         </p>
         <div class="copytoclipboard-wrapper">
          <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa31323067"><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-terminal">mysqlbackup <span class="token constant">--defaults-file</span><span class="token attr-value"><span class="token punctuation">=</span>/etc/my.cnf</span> \
  <span class="token constant">--datadir</span><span class="token attr-value"><span class="token punctuation">=</span>/var/lib/mysql</span> \
  <span class="token constant">--backup-image</span><span class="token attr-value"><span class="token punctuation">=</span>/backups/my.mbi_2206_1429</span>  \
  <span class="token constant">--log-bin</span><span class="token attr-value"><span class="token punctuation">=</span>s3-bin</span> <span class="token constant">--relay-log</span><span class="token attr-value"><span class="token punctuation">=</span>s3-relay-bin</span> \
  <span class="token constant">--backup-dir</span><span class="token attr-value"><span class="token punctuation">=</span>/tmp/restore_`date</span> +%d%m_%H%M` copy-back-and-apply-log</code></pre>
         </div>
         <p>
          Being able to restore the binary log and relay log to
                the right file paths makes the restore process easier;
                if that is impossible for some reason, see
          <a class="xref" href="group-replication-enterprise-backup.html#group-replication-rebuild-member" title="Rebuild the Failed Member to Rejoin as a New Member">
           Rebuild the Failed Member to Rejoin as a New Member
          </a>
          .
         </p>
        </div>
       </li>
      </ol>
     </div>
    </li>
    <li class="listitem">
     <p>
      <span class="emphasis">
       <em>
        Restore the
        <code class="filename">
         auto.cnf
        </code>
        file for
          s3.
       </em>
      </span>
      To rejoin the replication group, the restored
          member
      <span class="emphasis">
       <em>
        must
       </em>
      </span>
      have the same
      <a class="link" href="replication-options.html#sysvar_server_uuid">
       <code class="literal">
        server_uuid
       </code>
      </a>
      it used to join
          the group before. Supply the old server UUID by copying the
      <code class="filename">
       auto.cnf
      </code>
      file preserved in step 2 above
          into the data directory of the restored member.
     </p>
     <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
      <div class="admon-title">
       Note
      </div>
      <p>
       If you cannot supply the failed member's original
       <a class="link" href="replication-options.html#sysvar_server_uuid">
        <code class="literal">
         server_uuid
        </code>
       </a>
       to the restored
            member by restoring its old
       <code class="filename">
        auto.cnf
       </code>
       file, you must let the restored member join the group as a
            new member; see instructions in
       <a class="xref" href="group-replication-enterprise-backup.html#group-replication-rebuild-member" title="Rebuild the Failed Member to Rejoin as a New Member">
        Rebuild the Failed Member to Rejoin as a New Member
       </a>
       below on
            how to do that.
      </p>
     </div>
    </li>
    <li class="listitem">
     <p>
      <span class="emphasis">
       <em>
        Restore the
        <code class="filename">
         mysqld-auto.cnf
        </code>
        file for s3 (only required if s3 used persistent system
          variables).
       </em>
      </span>
      The settings for the
      <a class="xref" href="persisted-system-variables.html" title="7.1.9.3 Persisted System Variables">
       Section 7.1.9.3, “Persisted System Variables”
      </a>
      that were used to
          configure the failed member must be provided to the restored
          member. These settings are to be found in the
      <code class="filename">
       mysqld-auto.cnf
      </code>
      file of the failed
          server, which you should have preserved in step 2 above.
          Restore the file to the data directory of the restored server.
          See
      <a class="xref" href="group-replication-enterprise-backup.html#group-replication-meb-restore-persisted-variables" title="Restoring Persisted System Variables">
       Restoring Persisted System Variables
      </a>
      on what to do if you do not have a copy of the file.
     </p>
    </li>
    <li class="listitem">
     <p>
      <span class="emphasis">
       <em>
        Start the restored server.
       </em>
      </span>
      For example,
          on Linux distributions that use systemd:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa87433591"><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-terminal">systemctl start mysqld</code></pre>
     </div>
     <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
      <div class="admon-title">
       Note
      </div>
      <p>
       If the server you are restoring is a primary member, perform
            the steps described in
       <a class="xref" href="group-replication-enterprise-backup.html#group-replication-meb-restore-primary" title="Restoring a Primary Member">
        Restoring a Primary Member
       </a>
       <span class="emphasis">
        <em>
         before starting the restored server
        </em>
       </span>
       .
      </p>
     </div>
    </li>
    <li class="listitem">
     <p>
      <span class="emphasis">
       <em>
        Restart Group Replication.
       </em>
      </span>
      Connect to the
          restarted
      <code class="literal">
       s3
      </code>
      using, for example, a
      <a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
       <span class="command">
        <strong>
         mysql
        </strong>
       </span>
      </a>
      client, and issue the following
          statement:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa72156766"><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">START</span> <span class="token keyword">GROUP_REPLICATION</span><span class="token punctuation">;</span></code></pre>
     </div>
     <p>
      Before the restored instance can become an online member of
          the group, it needs to apply any transactions that have
          happened to the group after the backup was taken; this is
          achieved using Group Replication's
      <a class="link" href="group-replication-distributed-recovery.html" title="20.5.4 Distributed Recovery">
       distributed
          recovery
      </a>
      mechanism, and the process starts after the
      <a class="link" href="start-group-replication.html" title="15.4.3.1 START GROUP_REPLICATION Statement">
       START
          GROUP_REPLICATION
      </a>
      statement has been issued. To check
          the member status of the restored instance, issue:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa62306035"><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> member_host<span class="token punctuation">,</span> member_port<span class="token punctuation">,</span> member_state <span class="token keyword">FROM</span> performance_schema<span class="token punctuation">.</span>replication_group_members<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><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> member_host <span class="token punctuation">|</span> member_port <span class="token punctuation">|</span> member_state <span class="token punctuation">|</span></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><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> s1          <span class="token punctuation">|</span>        3306 <span class="token punctuation">|</span> ONLINE       <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> s2          <span class="token punctuation">|</span>        3306 <span class="token punctuation">|</span> ONLINE       <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> s3          <span class="token punctuation">|</span>        3306 <span class="token punctuation">|</span> RECOVERING   <span class="token punctuation">|</span></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><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
     </div>
     <p>
      This shows that
      <code class="literal">
       s3
      </code>
      is applying transactions
          to catch up with the group. Once it has caught up with the
          rest of the group, its
      <code class="literal">
       member_state
      </code>
      changes
          to
      <code class="literal">
       ONLINE
      </code>
      :
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa12565947"><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> member_host<span class="token punctuation">,</span> member_port<span class="token punctuation">,</span> member_state <span class="token keyword">FROM</span> performance_schema<span class="token punctuation">.</span>replication_group_members<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><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> member_host <span class="token punctuation">|</span> member_port <span class="token punctuation">|</span> member_state <span class="token punctuation">|</span></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><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> s1          <span class="token punctuation">|</span>        3306 <span class="token punctuation">|</span> ONLINE       <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> s2          <span class="token punctuation">|</span>        3306 <span class="token punctuation">|</span> ONLINE       <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> s3          <span class="token punctuation">|</span>        3306 <span class="token punctuation">|</span> ONLINE       <span class="token punctuation">|</span></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><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
     </div>
     <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
      <div class="admon-title">
       Note
      </div>
      <p>
       If the server you are restoring is a primary member, once it
            has gained synchrony with the group and become
       <code class="literal">
        ONLINE
       </code>
       , perform the steps described at
            the end of
       <a class="xref" href="group-replication-enterprise-backup.html#group-replication-meb-restore-primary" title="Restoring a Primary Member">
        Restoring a Primary Member
       </a>
       to
            revert the configuration changes you had made to the server
            before you started it.
      </p>
     </div>
    </li>
   </ol>
  </div>
  <p>
   The member has now been fully restored from the backup and
      functions as a regular member of the group.
  </p>
  <h4>
   <a name="group-replication-rebuild-member">
   </a>
   Rebuild the Failed Member to Rejoin as a New Member
  </h4>
  <p>
   Sometimes, the steps outlined above in
   <a class="xref" href="group-replication-enterprise-backup.html#group-replication-restore-failed-member" title="Restoring a Failed Member">
    Restoring a Failed Member
   </a>
   cannot
      be carried out because, for example, the binary log or relay log
      is corrupted, or it is just missing from the backup. In such a
      situation, use the backup to rebuild the member, and then add it
      to the group as a new member. In the steps below, we assume the
      rebuilt member is named
   <code class="literal">
    s3
   </code>
   , like the failed
      member, and that it runs on the same host as
   <code class="literal">
    s3
   </code>
   :
  </p>
  <div class="orderedlist">
   <ol class="orderedlist" type="1">
    <li class="listitem">
     <p>
      <span class="emphasis">
       <em>
        Copy the backup of s2 onto the host for s3
          .
       </em>
      </span>
      The exact way to copy the backup depends on the
          operating system and tools available to you. In this example
          we assume the hosts are both Linux servers and use SCP to copy
          the files between them:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa34876704"><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-terminal">s2/backups&gt; scp my<span class="token punctuation">.</span>mbi_2206_1429 s3<span class="token punctuation">:</span>/backups</code></pre>
     </div>
    </li>
    <li class="listitem">
     <p>
      <span class="emphasis">
       <em>
        Restore the backup.
       </em>
      </span>
      Connect to the target
          host (the host for
      <code class="literal">
       s3
      </code>
      in this case), and
          restore the backup using MySQL Enterprise Backup. Here are the steps:
     </p>
     <div class="orderedlist">
      <ol class="orderedlist" type="a">
       <li class="listitem">
        <p>
         Stop the corrupted server, if it is still running. For
              example, on Linux distributions that use systemd:
        </p>
        <div class="copytoclipboard-wrapper">
         <pre class="programlisting one-line language-simple"><div class="docs-select-all right" id="sa12324338"><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-simple">s3<span class="token operator">&gt;</span> systemctl stop mysqld</code></pre>
        </div>
       </li>
       <li class="listitem">
        <p>
         Preserve the configuration file
         <code class="filename">
          mysqld-auto.cnf
         </code>
         , if it is found in
              the corrupted server's data directory, by copying it to a
              safe location outside of the data directory. This is for
              preserving the server's
         <a class="xref" href="persisted-system-variables.html" title="7.1.9.3 Persisted System Variables">
          Section 7.1.9.3, “Persisted System Variables”
         </a>
         , which are
              needed later.
        </p>
       </li>
       <li class="listitem">
        <p>
         Delete all contents in the data directory of
         <code class="literal">
          s3
         </code>
         . For example:
        </p>
        <div class="copytoclipboard-wrapper">
         <pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa89115807"><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-terminal">s3&gt; rm <span class="token property">-rf</span> /var/lib/mysql/*</code></pre>
        </div>
        <p>
         If the system variables
         <a class="link" href="innodb-parameters.html#sysvar_innodb_data_home_dir">
          <code class="literal">
           innodb_data_home_dir
          </code>
         </a>
         ,
         <a class="link" href="innodb-parameters.html#sysvar_innodb_log_group_home_dir">
          <code class="literal">
           innodb_log_group_home_dir
          </code>
         </a>
         ,
              and
         <a class="link" href="innodb-parameters.html#sysvar_innodb_undo_directory">
          <code class="literal">
           innodb_undo_directory
          </code>
         </a>
         point to any directories other than the data directory,
              they should also be made empty; otherwise, the restore
              operation fails.
        </p>
       </li>
       <li class="listitem">
        <p>
         Restore the backup of
         <code class="literal">
          s2
         </code>
         onto the host
              of
         <code class="literal">
          s3
         </code>
         . With this approach, we are
              rebuilding
         <code class="literal">
          <code class="literal">
           s3
          </code>
         </code>
         as a
              new member, for which we do not need or do not want to use
              the old binary and relay logs in the backup; therefore, if
              these logs have been included in your backup, exclude them
              using the
         <a class="ulink" href="/doc/mysql-enterprise-backup/8.4/en/backup-capacity-options.html#option_meb_skip-binlog" target="_top">
          <code class="option">
           --skip-binlog
          </code>
         </a>
         and
         <a class="ulink" href="/doc/mysql-enterprise-backup/8.4/en/backup-capacity-options.html#option_meb_skip-relaylog" target="_top">
          <code class="option">
           --skip-relaylog
          </code>
         </a>
         options:
        </p>
        <div class="copytoclipboard-wrapper">
         <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa73627464"><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-terminal">s3&gt; mysqlbackup <span class="token constant">--defaults-file</span><span class="token attr-value"><span class="token punctuation">=</span>/etc/my.cnf</span> \
  <span class="token constant">--datadir</span><span class="token attr-value"><span class="token punctuation">=</span>/var/lib/mysql</span> \
  <span class="token constant">--backup-image</span><span class="token attr-value"><span class="token punctuation">=</span>/backups/my.mbi_2206_1429</span>  \
  <span class="token constant">--backup-dir</span><span class="token attr-value"><span class="token punctuation">=</span>/tmp/restore_`date</span> +%d%m_%H%M` \
  <span class="token property">--skip-binlog</span> <span class="token property">--skip-relaylog</span> \
copy-back-and-apply-log</code></pre>
        </div>
        <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
         <div class="admon-title">
          Note
         </div>
         <p>
          If you have healthy binary log and relay logs in the
                backup that you can transfer onto the target host with
                no issues, you are recommended to follow the easier
                procedure as described in
          <a class="xref" href="group-replication-enterprise-backup.html#group-replication-restore-failed-member" title="Restoring a Failed Member">
           Restoring a Failed Member
          </a>
          above.
         </p>
        </div>
       </li>
      </ol>
     </div>
    </li>
    <li class="listitem">
     <p>
      <span class="emphasis">
       <em>
        Restore the
        <code class="filename">
         mysqld-auto.cnf
        </code>
        file for s3 (only required if s3 used persistent system
          variables).
       </em>
      </span>
      The settings for the
      <a class="xref" href="persisted-system-variables.html" title="7.1.9.3 Persisted System Variables">
       Section 7.1.9.3, “Persisted System Variables”
      </a>
      that were used to
          configure the failed member must be provided to the restored
          server. These settings are to be found in the
      <code class="filename">
       mysqld-auto.cnf
      </code>
      file of the failed
          server, which you should have preserved in step 2 above.
          Restore the file to the data directory of the restored server.
          See
      <a class="xref" href="group-replication-enterprise-backup.html#group-replication-meb-restore-persisted-variables" title="Restoring Persisted System Variables">
       Restoring Persisted System Variables
      </a>
      on what to do if you do not have a copy of the file.
     </p>
     <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
      <div class="admon-title">
       Note
      </div>
      <p>
       Do NOT restore the corrupted server's
       <code class="filename">
        auto.cnf
       </code>
       file to the data directory of
            the new member—when the rebuilt
       <code class="literal">
        s3
       </code>
       joins the group as a new member, it is going to be assigned
            a new server UUID.
      </p>
     </div>
    </li>
    <li class="listitem">
     <p>
      <span class="emphasis">
       <em>
        Start the restored server.
       </em>
      </span>
      For example,
          on Linux distributions that use systemd:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa95482513"><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-terminal">systemctl start mysqld</code></pre>
     </div>
     <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
      <div class="admon-title">
       Note
      </div>
      <p>
       If the server you are restoring is a primary member, perform
            the steps described in
       <a class="xref" href="group-replication-enterprise-backup.html#group-replication-meb-restore-primary" title="Restoring a Primary Member">
        Restoring a Primary Member
       </a>
       <span class="emphasis">
        <em>
         before starting the restored server
        </em>
       </span>
       .
      </p>
     </div>
    </li>
    <li class="listitem">
     <p>
      <span class="emphasis">
       <em>
        Reconfigure the restored member to join Group
          Replication.
       </em>
      </span>
      Connect to the restored server with a
      <a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
       <span class="command">
        <strong>
         mysql
        </strong>
       </span>
      </a>
      client and reset the source and
          replica information with the following statements:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa34867085"><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">RESET</span> <span class="token datatype">BINARY</span> <span class="token keyword">LOGS</span> <span class="token operator">AND</span> GTIDS<span class="token punctuation">;</span>

<span class="token prompt">mysql&gt;</span> <span class="token keyword">RESET</span> <span class="token keyword">REPLICA</span> <span class="token keyword">ALL</span><span class="token punctuation">;</span></code></pre>
     </div>
     <p>
      For the restored server to be able to recover automatically
          using Group Replication's built-in mechanism for
      <a class="link" href="group-replication-distributed-recovery.html" title="20.5.4 Distributed Recovery">
       distributed
          recovery
      </a>
      , configure the server's
      <a class="link" href="replication-options-gtids.html#sysvar_gtid_executed">
       <code class="literal">
        gtid_executed
       </code>
      </a>
      variable. To do
          this, use the
      <code class="filename">
       backup_gtid_executed.sql
      </code>
      file included in the backup of
      <code class="literal">
       s2
      </code>
      , which is
          usually restored under the restored member's data directory.
          Disable binary logging, use the
      <code class="filename">
       backup_gtid_executed.sql
      </code>
      file to
          configure
      <a class="link" href="replication-options-gtids.html#sysvar_gtid_executed">
       <code class="literal">
        gtid_executed
       </code>
      </a>
      , and
          then re-enable binary logging by issuing the following
          statements with your
      <a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
       <span class="command">
        <strong>
         mysql
        </strong>
       </span>
      </a>
      client:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa36626696"><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">SET</span> SQL_LOG_BIN<span class="token operator">=</span><span class="token keyword">OFF</span><span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SOURCE</span> <em class="replaceable">datadir</em><span class="token operator">/</span>backup_gtid_executed<span class="token punctuation">.</span><span class="token keyword">sql</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SET</span> SQL_LOG_BIN<span class="token operator">=</span><span class="token keyword">ON</span><span class="token punctuation">;</span></code></pre>
     </div>
     <p>
      Then, configure the
      <a class="link" href="group-replication-user-credentials.html" title="20.2.1.3 User Credentials For Distributed Recovery">
       Group
          Replication user credentials
      </a>
      on the member using the
          SQL statements shown here:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa546456"><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">CHANGE</span> <span class="token keyword">REPLICATION</span> <span class="token keyword">SOURCE</span> <span class="token keyword">TO</span> <span class="token keyword">SOURCE_USER</span><span class="token operator">=</span><span class="token string">'<em class="replaceable">rpl_user</em>'</span><span class="token punctuation">,</span> 
<span class="token prompt">    -&gt;</span>   <span class="token keyword">SOURCE_PASSWORD</span><span class="token operator">=</span><span class="token string">'<em class="replaceable">password</em>'</span>
<span class="token prompt">    -&gt;</span>   <span class="token keyword">FOR</span> <span class="token keyword">CHANNEL</span> <span class="token string">'group_replication_recovery'</span><span class="token punctuation">;</span></code></pre>
     </div>
    </li>
    <li class="listitem">
     <p>
      <span class="emphasis">
       <em>
        Restart Group Replication.
       </em>
      </span>
      Issue the
          following statement to the restored server with your
      <a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
       <span class="command">
        <strong>
         mysql
        </strong>
       </span>
      </a>
      client:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa31682683"><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">START</span> <span class="token keyword">GROUP_REPLICATION</span><span class="token punctuation">;</span></code></pre>
     </div>
     <p>
      Before the restored instance can become an online member of
          the group, it needs to apply any transactions that have
          happened to the group after the backup was taken; this is
          achieved using Group Replication's
      <a class="link" href="group-replication-distributed-recovery.html" title="20.5.4 Distributed Recovery">
       distributed
          recovery
      </a>
      mechanism, and the process starts after the
      <a class="link" href="start-group-replication.html" title="15.4.3.1 START GROUP_REPLICATION Statement">
       START
          GROUP_REPLICATION
      </a>
      statement has been issued. To check
          the member status of the restored instance, issue:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa8444444"><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> member_host<span class="token punctuation">,</span> member_port<span class="token punctuation">,</span> member_state <span class="token keyword">FROM</span> performance_schema<span class="token punctuation">.</span>replication_group_members<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><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> member_host <span class="token punctuation">|</span> member_port <span class="token punctuation">|</span> member_state <span class="token punctuation">|</span></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><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> s3          <span class="token punctuation">|</span>        3306 <span class="token punctuation">|</span> RECOVERING   <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> s2          <span class="token punctuation">|</span>        3306 <span class="token punctuation">|</span> ONLINE       <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> s1          <span class="token punctuation">|</span>        3306 <span class="token punctuation">|</span> ONLINE       <span class="token punctuation">|</span></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><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
     </div>
     <p>
      This shows that
      <code class="literal">
       s3
      </code>
      is applying transactions
          to catch up with the group. Once it has caught up with the
          rest of the group, its
      <code class="literal">
       member_state
      </code>
      changes
          to
      <code class="literal">
       ONLINE
      </code>
      :
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa10403582"><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> member_host<span class="token punctuation">,</span> member_port<span class="token punctuation">,</span> member_state <span class="token keyword">FROM</span> performance_schema<span class="token punctuation">.</span>replication_group_members<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><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> member_host <span class="token punctuation">|</span> member_port <span class="token punctuation">|</span> member_state <span class="token punctuation">|</span></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><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> s3          <span class="token punctuation">|</span>        3306 <span class="token punctuation">|</span> ONLINE       <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> s2          <span class="token punctuation">|</span>        3306 <span class="token punctuation">|</span> ONLINE       <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> s1          <span class="token punctuation">|</span>        3306 <span class="token punctuation">|</span> ONLINE       <span class="token punctuation">|</span></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><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
     </div>
     <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
      <div class="admon-title">
       Note
      </div>
      <p>
       If the server you are restoring is a primary member, once it
            has gained synchrony with the group and become
       <code class="literal">
        ONLINE
       </code>
       , perform the steps described at
            the end of
       <a class="xref" href="group-replication-enterprise-backup.html#group-replication-meb-restore-primary" title="Restoring a Primary Member">
        Restoring a Primary Member
       </a>
       to
            revert the configuration changes you had made to the server
            before you started it.
      </p>
     </div>
    </li>
   </ol>
  </div>
  <p>
   The member has now been restored to the group as a new member.
  </p>
  <p>
   <a name="group-replication-meb-restore-persisted-variables">
   </a>
   <b>
    Restoring Persisted System Variables.
   </b>
   <span class="command">
    <strong>
     mysqlbackup
    </strong>
   </span>
   does not provide support for
        backing up or preserving
   <a class="xref" href="persisted-system-variables.html" title="7.1.9.3 Persisted System Variables">
    Section 7.1.9.3, “Persisted System Variables”
   </a>
   —the file
   <code class="filename">
    mysqld-auto.cnf
   </code>
   is not included in a
        backup. To start the restored member with its persisted variable
        settings, you need to do one of the following:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      Preserve a copy of the
      <code class="filename">
       mysqld-auto.cnf
      </code>
      file from the corrupted server, and copy it to the restored
          server's data directory.
     </p>
    </li>
    <li class="listitem">
     <p>
      Copy the
      <code class="filename">
       mysqld-auto.cnf
      </code>
      file from
          another member of the group into the restored server's data
          directory, if that member has the same persisted system
          variable settings as the corrupted member.
     </p>
    </li>
    <li class="listitem">
     <p>
      After the restored server is started and before you restart
          Group Replication, set all the system variables manually to
          their persisted values through a
      <a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
       <span class="command">
        <strong>
         mysql
        </strong>
       </span>
      </a>
      client.
     </p>
    </li>
   </ul>
  </div>
  <p>
   <a name="group-replication-meb-restore-primary">
   </a>
   <b>
    Restoring a Primary Member.
   </b>
   If the restored member is a primary in the group, care must be
        taken to prevent writes to the restored database during the
        Group Replication distributed recovery process. Depending on how
        the group is accessed by clients, there is a possibility of DML
        statements being executed on the restored member once it becomes
        accessible on the network, prior to the member finishing its
        catch-up on the activities it has missed while off the group. To
        avoid this,
   <span class="emphasis">
    <em>
     before starting the restored
        server
    </em>
   </span>
   , configure the following system variables in
        the server option file:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-ini"><div class="docs-select-all right" id="sa40131917"><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 constant">group_replication_start_on_boot</span><span class="token attr-value"><span class="token punctuation">=</span>OFF</span>
<span class="token constant">super_read_only</span><span class="token attr-value"><span class="token punctuation">=</span>ON</span>
<span class="token constant">event_scheduler</span><span class="token attr-value"><span class="token punctuation">=</span>OFF</span></code></pre>
  </div>
  <p>
   These settings ensure that the member becomes read-only at
      startup, and that the event scheduler is turned off while the
      member catches up with the group during the distributed recovery
      process. Adequate error handling must also be provided for on the
      clients, since they are unable to perform DML operations during
      this period on the member being restored.
  </p>
  <p>
   Once the restoration process is fully completed and the restored
      member is synchronized with the rest of the group, you can revert
      these changes. First, restart the event scheduler using the
      statement shown here:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa65183805"><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">SET</span> <span class="token keyword">global</span> event_scheduler<span class="token operator">=</span><span class="token keyword">ON</span><span class="token punctuation">;</span></code></pre>
  </div>
  <p>
   After this, you should set the following system variables in the
      member's option file, so that they have the necessary values
      for the next time that the member is started:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-ini"><div class="docs-select-all right" id="sa43412420"><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 constant">group_replication_start_on_boot</span><span class="token attr-value"><span class="token punctuation">=</span>ON</span>
<span class="token constant">super_read_only</span><span class="token attr-value"><span class="token punctuation">=</span>OFF</span>
<span class="token constant">event_scheduler</span><span class="token attr-value"><span class="token punctuation">=</span>ON</span></code></pre>
  </div>
 </div>
 <br/>
</div>
