<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="clone-plugin-remote">
      </a>
      7.6.7.3 Cloning Remote Data
     </h4>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045255640512">
  </a>
  <p>
   The clone plugin supports the following syntax for cloning
        remote data; that is, cloning data from a remote MySQL server
        instance (the donor) and transferring it to the MySQL instance
        where the cloning operation was initiated (the recipient).
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa15705624"><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">CLONE</span> <span class="token keyword">INSTANCE</span> <span class="token keyword">FROM</span> <span class="token string">'<em class="replaceable">user</em>'</span>@<span class="token string">'<em class="replaceable">host</em>'</span>:<span class="token keyword"><em class="replaceable">port</em></span>
<span class="token keyword">IDENTIFIED</span> <span class="token keyword">BY</span> <span class="token string">'<em class="replaceable">password</em>'</span>
<span class="token punctuation">[</span><span class="token keyword">DATA</span> <span class="token keyword">DIRECTORY</span> <span class="token punctuation">[</span><span class="token operator">=</span><span class="token punctuation">]</span> <span class="token string">'<em class="replaceable">clone_dir</em>'</span><span class="token punctuation">]</span>
<span class="token punctuation">[</span><span class="token keyword">REQUIRE</span> <span class="token punctuation">[</span><span class="token keyword">NO</span><span class="token punctuation">]</span> <span class="token keyword">SSL</span><span class="token punctuation">]</span><span class="token punctuation">;</span></code></pre>
  </div>
  <p>
   where:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <code class="literal">
       <em class="replaceable">
        <code>
         user
        </code>
       </em>
      </code>
      is the
            clone user on the donor MySQL server instance.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       <em class="replaceable">
        <code>
         password
        </code>
       </em>
      </code>
      is
            the
      <code class="literal">
       <em class="replaceable">
        <code>
         user
        </code>
       </em>
      </code>
      password.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       <em class="replaceable">
        <code>
         host
        </code>
       </em>
      </code>
      is the
      <a class="link" href="server-system-variables.html#sysvar_hostname">
       <code class="literal">
        hostname
       </code>
      </a>
      address of the
            donor MySQL server instance. Internet Protocol version 6
            (IPv6) address format is not supported. An alias to the IPv6
            address can be used instead. An IPv4 address can be used as
            is.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       <em class="replaceable">
        <code>
         port
        </code>
       </em>
      </code>
      is the
      <a class="link" href="server-system-variables.html#sysvar_port">
       <code class="literal">
        port
       </code>
      </a>
      number of the donor
            MySQL server instance. (The X Protocol port specified by
      <a class="link" href="x-plugin-options-system-variables.html#sysvar_mysqlx_port">
       <code class="literal">
        mysqlx_port
       </code>
      </a>
      is not
            supported. Connecting to the donor MySQL server instance
            through MySQL Router is also not supported.)
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       DATA DIRECTORY [=]
            '
       <em class="replaceable">
        <code>
         clone_dir
        </code>
       </em>
       '
      </code>
      is an
            optional clause used to specify a directory on the recipient
            for the data you are cloning. Use this option if you do not
            want to remove existing user-created data (schemas, tables,
            tablespaces) and binary logs from the recipient data
            directory. An absolute path is required, and the directory
            must not exist. The MySQL server must have the necessary
            write access to create the directory.
     </p>
     <p>
      When the optional
      <code class="literal">
       DATA DIRECTORY [=]
            '
       <em class="replaceable">
        <code>
         clone_dir
        </code>
       </em>
       '
      </code>
      clause is
            not used, a cloning operation removes user-created data
            (schemas, tables, tablespaces) and binary logs from the
            recipient data directory, clones the new data to the
            recipient data directory, and automatically restarts the
            server afterward.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       [REQUIRE [NO] SSL]
      </code>
      explicitly specifies
            whether an encrypted connection is to be used or not when
            transferring cloned data over the network. An error is
            returned if the explicit specification cannot be satisfied.
            If an SSL clause is not specified, clone attempts to
            establish an encrypted connection by default, falling back
            to an insecure connection if the secure connection attempt
            fails. A secure connection is required when cloning
            encrypted data regardless of whether this clause is
            specified. For more information, see
      <a class="xref" href="clone-plugin-remote.html#clone-plugin-remote-ssl" title="Configuring an Encrypted Connection for Cloning">
       Configuring an Encrypted Connection for Cloning
      </a>
      .
     </p>
    </li>
   </ul>
  </div>
  <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
   <div class="admon-title">
    Note
   </div>
   <p>
    By default, user-created
    <code class="literal">
     InnoDB
    </code>
    tables and
          tablespaces that reside in the data directory on the donor
          MySQL server instance are cloned to the data directory on the
          recipient MySQL server instance. If the
    <code class="literal">
     DATA
          DIRECTORY [=] '
     <em class="replaceable">
      <code>
       clone_dir
      </code>
     </em>
     '
    </code>
    clause is specified, they are cloned to the specified
          directory.
   </p>
   <p>
    User-created
    <code class="literal">
     InnoDB
    </code>
    tables and tablespaces
          that reside outside of the data directory on the donor MySQL
          server instance are cloned to the same path on the recipient
          MySQL server instance. An error is reported if a table or
          tablespace already exists.
   </p>
   <p>
    By default, the
    <code class="literal">
     InnoDB
    </code>
    system tablespace,
          redo logs, and undo tablespaces are cloned to the same
          locations that are configured on the donor (as defined by
    <a class="link" href="innodb-parameters.html#sysvar_innodb_data_home_dir">
     <code class="literal">
      innodb_data_home_dir
     </code>
    </a>
    and
    <a class="link" href="innodb-parameters.html#sysvar_innodb_data_file_path">
     <code class="literal">
      innodb_data_file_path
     </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>
    ,
          respectively). If the
    <code class="literal">
     DATA DIRECTORY [=]
          '
     <em class="replaceable">
      <code>
       clone_dir
      </code>
     </em>
     '
    </code>
    clause is
          specified, those tablespaces and logs are cloned to the
          specified directory.
   </p>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="clone-remote-prerequisites">
       </a>
       Remote Cloning Prerequisites
      </h5>
     </div>
    </div>
   </div>
   <a class="indexterm" name="idm46045255602464">
   </a>
   <p>
    To perform a cloning operation, the clone plugin must be
          active on both the donor and recipient MySQL server instances.
          For installation instructions, see
    <a class="xref" href="clone-plugin-installation.html" title="7.6.7.1 Installing the Clone Plugin">
     Section 7.6.7.1, “Installing the Clone Plugin”
    </a>
    .
   </p>
   <p>
    A MySQL user on the donor and recipient is required for
          executing the cloning operation (the
    <span class="quote">
     “
     <span class="quote">
      clone
          user
     </span>
     ”
    </span>
    ).
   </p>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       On the donor, the clone user requires the
       <a class="link" href="privileges-provided.html#priv_backup-admin">
        <code class="literal">
         BACKUP_ADMIN
        </code>
       </a>
       privilege for
              accessing and transferring data from the donor and
              blocking concurrent DDL during the cloning operation.
              Concurrent DDL is permitted on the donor by default. See
       <a class="xref" href="clone-plugin-concurrent-ddl.html" title="7.6.7.4 Cloning and Concurrent DDL">
        Section 7.6.7.4, “Cloning and Concurrent DDL”
       </a>
       .
      </p>
     </li>
     <li class="listitem">
      <p>
       On the recipient, the clone user requires the
       <a class="link" href="privileges-provided.html#priv_clone-admin">
        <code class="literal">
         CLONE_ADMIN
        </code>
       </a>
       privilege for
              replacing recipient data, blocking DDL on the recipient
              during the cloning operation, and automatically restarting
              the server. The
       <a class="link" href="privileges-provided.html#priv_clone-admin">
        <code class="literal">
         CLONE_ADMIN
        </code>
       </a>
       privilege includes
       <a class="link" href="privileges-provided.html#priv_backup-admin">
        <code class="literal">
         BACKUP_ADMIN
        </code>
       </a>
       and
       <a class="link" href="privileges-provided.html#priv_shutdown">
        <code class="literal">
         SHUTDOWN
        </code>
       </a>
       privileges
              implicitly.
      </p>
     </li>
    </ul>
   </div>
   <p>
    Instructions for creating the clone user and granting the
          required privileges are included in the remote cloning example
          that follows this prerequisite information.
   </p>
   <p>
    The following prerequisites are checked when the
    <a class="link" href="clone.html" title="15.7.5 CLONE Statement">
     <code class="literal">
      CLONE
          INSTANCE
     </code>
    </a>
    statement is executed:
   </p>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       The donor and recipient must be the same MySQL server
              series, such as 8.4.0 and 8.4.11. To determine the MySQL
              server version, issue the following query:
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa58255659"><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">VARIABLES</span> <span class="token operator">LIKE</span> <span class="token string">'version'</span><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>
<span class="token output"><span class="token punctuation">|</span> Variable_name <span class="token punctuation">|</span> Value <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>
<span class="token output"><span class="token punctuation">|</span> version       <span class="token punctuation">|</span> 8.4.3 <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></code></pre>
      </div>
     </li>
     <li class="listitem">
      <p>
       The donor and recipient MySQL server instances must run on
              the same operating system and platform. For example, if
              the donor instance runs on a Linux 64-bit platform, the
              recipient instance must also run on that platform. Refer
              to your operating system documentation for information
              about how to determine your operating system platform.
      </p>
     </li>
     <li class="listitem">
      <p>
       The recipient must have enough disk space for the cloned
              data. By default, user-created data (schemas, tables,
              tablespaces) and binary logs are removed on the recipient
              prior to cloning the donor data, so you only require
              enough space for the donor data. If you clone to a named
              directory using the
       <code class="literal">
        DATA DIRECTORY
       </code>
       clause, you must have enough disk space for the existing
              recipient data and the cloned data. You can estimate the
              size of your data by checking the data directory size on
              your file system and the size of any tablespaces that
              reside outside of the data directory. When estimating data
              size on the donor, remember that only
       <code class="literal">
        InnoDB
       </code>
       data is cloned. If you store
              data in other storage engines, adjust your data size
              estimate accordingly.
      </p>
     </li>
     <li class="listitem">
      <p>
       <code class="literal">
        InnoDB
       </code>
       permits creating some tablespace
              types outside of the data directory. If the donor MySQL
              server instance has tablespaces that reside outside of the
              data directory, the cloning operation must be able access
              those tablespaces. You can query the Information Schema
       <a class="link" href="information-schema-files-table.html" title="28.3.15 The INFORMATION_SCHEMA FILES Table">
        <code class="literal">
         FILES
        </code>
       </a>
       table to identify
              tablespaces that reside outside of the data directory.
              Files that reside outside of the data directory have a
              fully qualified path to a directory other than the data
              directory.
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa75248760"><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> FILE_NAME <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span>FILES<span class="token punctuation">;</span></code></pre>
      </div>
     </li>
     <li class="listitem">
      <p>
       Plugins that are active on the donor, including any
              keyring plugin, must also be active on the recipient. You
              can identify active plugins by issuing a
       <a class="link" href="show-plugins.html" title="15.7.7.27 SHOW PLUGINS Statement">
        <code class="literal">
         SHOW PLUGINS
        </code>
       </a>
       statement or
              by querying the Information Schema
       <a class="link" href="information-schema-plugins-table.html" title="28.3.22 The INFORMATION_SCHEMA PLUGINS Table">
        <code class="literal">
         PLUGINS
        </code>
       </a>
       table.
      </p>
     </li>
     <li class="listitem">
      <p>
       The donor and recipient must have the same MySQL server
              character set and collation. For information about MySQL
              server character set and collation configuration, see
       <a class="xref" href="charset-configuration.html" title="12.15 Character Set Configuration">
        Section 12.15, “Character Set Configuration”
       </a>
       .
      </p>
     </li>
     <li class="listitem">
      <p>
       The same
       <a class="link" href="innodb-parameters.html#sysvar_innodb_page_size">
        <code class="literal">
         innodb_page_size
        </code>
       </a>
       and
       <a class="link" href="innodb-parameters.html#sysvar_innodb_data_file_path">
        <code class="literal">
         innodb_data_file_path
        </code>
       </a>
       settings are required on the donor and recipient. The
       <a class="link" href="innodb-parameters.html#sysvar_innodb_data_file_path">
        <code class="literal">
         innodb_data_file_path
        </code>
       </a>
       setting on the donor and recipient must specify the same
              number of data files of an equivalent size. You can check
              variable settings using
       <a class="link" href="show-variables.html" title="15.7.7.41 SHOW VARIABLES Statement">
        <code class="literal">
         SHOW
              VARIABLES
        </code>
       </a>
       syntax.
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa88138840"><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">VARIABLES</span> <span class="token operator">LIKE</span> <span class="token string">'innodb_page_size'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SHOW</span> <span class="token keyword">VARIABLES</span> <span class="token operator">LIKE</span> <span class="token string">'innodb_data_file_path'</span><span class="token punctuation">;</span></code></pre>
      </div>
     </li>
     <li class="listitem">
      <p>
       If cloning encrypted or page-compressed data, the donor
              and recipient must have the same file system block size.
              For page-compressed data, the recipient file system must
              support sparse files and hole punching for hole punching
              to occur on the recipient. For information about these
              features and how to identify tables and tablespaces that
              use them, see
       <a class="xref" href="clone-plugin-encrypted-data.html" title="7.6.7.5 Cloning Encrypted Data">
        Section 7.6.7.5, “Cloning Encrypted Data”
       </a>
       , and
       <a class="xref" href="clone-plugin-compressed-data.html" title="7.6.7.6 Cloning Compressed Data">
        Section 7.6.7.6, “Cloning Compressed Data”
       </a>
       . To
              determine your file system block size, refer to your
              operating system documentation.
      </p>
     </li>
     <li class="listitem">
      <p>
       A secure connection is required if you are cloning
              encrypted data. See
       <a class="xref" href="clone-plugin-remote.html#clone-plugin-remote-ssl" title="Configuring an Encrypted Connection for Cloning">
        Configuring an Encrypted Connection for Cloning
       </a>
       .
      </p>
     </li>
     <li class="listitem">
      <p>
       The
       <a class="link" href="clone-plugin-options-variables.html#sysvar_clone_valid_donor_list">
        <code class="literal">
         clone_valid_donor_list
        </code>
       </a>
       setting on the recipient must include the host address of
              the donor MySQL server instance. You can only clone data
              from a host on the valid donor list. A MySQL user with the
       <a class="link" href="privileges-provided.html#priv_system-variables-admin">
        <code class="literal">
         SYSTEM_VARIABLES_ADMIN
        </code>
       </a>
       privilege is required to configure this variable.
              Instructions for setting the
       <a class="link" href="clone-plugin-options-variables.html#sysvar_clone_valid_donor_list">
        <code class="literal">
         clone_valid_donor_list
        </code>
       </a>
       variable are provided in the remote cloning example that
              follows this section. You can check the
       <a class="link" href="clone-plugin-options-variables.html#sysvar_clone_valid_donor_list">
        <code class="literal">
         clone_valid_donor_list
        </code>
       </a>
       setting using
       <a class="link" href="show-variables.html" title="15.7.7.41 SHOW VARIABLES Statement">
        <code class="literal">
         SHOW
              VARIABLES
        </code>
       </a>
       syntax.
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa87065006"><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">VARIABLES</span> <span class="token operator">LIKE</span> <span class="token string">'clone_valid_donor_list'</span><span class="token punctuation">;</span></code></pre>
      </div>
     </li>
     <li class="listitem">
      <p>
       There must be no other cloning operation running. Only a
              single cloning operation is permitted at a time. To
              determine if a clone operation is running, query the
       <a class="link" href="performance-schema-clone-status-table.html" title="29.12.19.1 The clone_status Table">
        <code class="literal">
         clone_status
        </code>
       </a>
       table. See
       <a class="xref" href="clone-plugin-monitoring.html#clone-plugin-monitoring-performance-schema-clone-tables" title="Monitoring Cloning Operations using Performance Schema Clone Tables">
        Monitoring Cloning Operations using Performance Schema Clone Tables
       </a>
       .
      </p>
     </li>
     <li class="listitem">
      <p>
       The clone plugin transfers data in 1MB packets plus
              metadata. The minimum required
       <a class="link" href="server-system-variables.html#sysvar_max_allowed_packet">
        <code class="literal">
         max_allowed_packet
        </code>
       </a>
       value
              is therefore 2MB on the donor and the recipient MySQL
              server instances. A
       <a class="link" href="server-system-variables.html#sysvar_max_allowed_packet">
        <code class="literal">
         max_allowed_packet
        </code>
       </a>
       value
              less than 2MB results in an error. Use the following query
              to check your
       <a class="link" href="server-system-variables.html#sysvar_max_allowed_packet">
        <code class="literal">
         max_allowed_packet
        </code>
       </a>
       setting:
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa1153174"><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">VARIABLES</span> <span class="token operator">LIKE</span> <span class="token string">'max_allowed_packet'</span><span class="token punctuation">;</span></code></pre>
      </div>
     </li>
    </ul>
   </div>
   <p>
    The following prerequisites also apply:
   </p>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       Undo tablespace file names on the donor must be unique.
              When data is cloned to the recipient, undo tablespaces,
              regardless of their location on the donor, are cloned to
              the
       <a class="link" href="innodb-parameters.html#sysvar_innodb_undo_directory">
        <code class="literal">
         innodb_undo_directory
        </code>
       </a>
       location on the recipient or to the directory specified by
              the
       <code class="literal">
        DATA DIRECTORY [=]
              '
        <em class="replaceable">
         <code>
          clone_dir
         </code>
        </em>
        '
       </code>
       clause,
              if used. Duplicate undo tablespace file names on the donor
              are not permitted for this reason. An error is reported if
              duplicate undo tablespace file names are encountered
              during a cloning operation.
      </p>
      <p>
       To view undo tablespace file names on the donor to ensure
              that they are unique, query the
       <a class="link" href="information-schema-files-table.html" title="28.3.15 The INFORMATION_SCHEMA FILES Table">
        <code class="literal">
         FILES
        </code>
       </a>
       table:
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa72841030"><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> TABLESPACE_NAME<span class="token punctuation">,</span> FILE_NAME <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span>FILES
       <span class="token keyword">WHERE</span> FILE_TYPE <span class="token operator">LIKE</span> <span class="token string">'UNDO LOG'</span><span class="token punctuation">;</span></code></pre>
      </div>
      <p>
       For information about dropping and adding undo tablespace
              files, see
       <a class="xref" href="innodb-undo-tablespaces.html" title="17.6.3.4 Undo Tablespaces">
        Section 17.6.3.4, “Undo Tablespaces”
       </a>
       .
      </p>
     </li>
     <li class="listitem">
      <p>
       By default, the recipient MySQL server instance is
              restarted (stopped and started) automatically after the
              data is cloned. For an automatic restart to occur, a
              monitoring process must be available on the recipient to
              detect server shutdowns. Otherwise, the cloning operation
              halts with the following error after the data is cloned,
              and the recipient MySQL server instance is shut down:
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa80238229"><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"><span class="token output">ERROR 3707 (HY000)<span class="token punctuation">:</span> Restart server failed (mysqld is not managed by supervisor process).</span></code></pre>
      </div>
      <p>
       This error does not indicate a cloning failure. It means
              that the recipient MySQL server instance must be started
              again manually after the data is cloned. After starting
              the server manually, you can connect to the recipient
              MySQL server instance and check the Performance Schema
              clone tables to verify that the cloning operation
              completed successfully (see
       <a class="xref" href="clone-plugin-monitoring.html#clone-plugin-monitoring-performance-schema-clone-tables" title="Monitoring Cloning Operations using Performance Schema Clone Tables">
        Monitoring Cloning Operations using Performance Schema Clone Tables
       </a>
       .)
              The
       <a class="link" href="restart.html" title="15.7.8.8 RESTART Statement">
        <code class="literal">
         RESTART
        </code>
       </a>
       statement has
              the same monitoring process requirement. For more
              information, see
       <a class="xref" href="restart.html" title="15.7.8.8 RESTART Statement">
        Section 15.7.8.8, “RESTART Statement”
       </a>
       . This
              requirement is not applicable if cloning to a named
              directory using the
       <code class="literal">
        DATA DIRECTORY
       </code>
       clause, as an automatic restart is not performed in this
              case.
      </p>
     </li>
     <li class="listitem">
      <p>
       Several variables control various aspects of a remote
              cloning operation. Before performing a remote cloning
              operation, review the variables and adjust settings as
              necessary to suit your computing environment. Clone
              variables are set on recipient MySQL server instance where
              the cloning operation is executed. See
       <a class="xref" href="clone-plugin-options-variables.html" title="7.6.7.13 Clone System Variables">
        Section 7.6.7.13, “Clone System Variables”
       </a>
       .
      </p>
     </li>
    </ul>
   </div>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="clone-plugin-remote-example">
       </a>
       Cloning Remote Data
      </h5>
     </div>
    </div>
   </div>
   <a class="indexterm" name="idm46045255520240">
   </a>
   <p>
    The following example demonstrates cloning remote data. By
          default, a remote cloning operation removes user-created data
          (schemas, tables, tablespaces) and binary logs on the
          recipient, clones the new data to the recipient data
          directory, and restarts the MySQL server afterward.
   </p>
   <p>
    The example assumes that remote cloning prerequisites are met.
          See
    <a class="xref" href="clone-plugin-remote.html#clone-remote-prerequisites" title="Remote Cloning Prerequisites">
     Remote Cloning Prerequisites
    </a>
    .
   </p>
   <div class="orderedlist">
    <ol class="orderedlist" type="1">
     <li class="listitem">
      <p>
       Login to the donor MySQL server instance with an
              administrative user account.
      </p>
      <div class="orderedlist">
       <ol class="orderedlist" type="a">
        <li class="listitem">
         <p>
          Create a clone user with the
          <a class="link" href="privileges-provided.html#priv_backup-admin">
           <code class="literal">
            BACKUP_ADMIN
           </code>
          </a>
          privilege.
         </p>
         <div class="copytoclipboard-wrapper">
          <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa34830859"><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">CREATE</span> <span class="token keyword">USER</span> <span class="token string">'donor_clone_user'</span>@<span class="token string">'example.donor.host.com'</span> <span class="token keyword">IDENTIFIED</span> <span class="token keyword">BY</span> <span class="token string">'<em class="replaceable">password</em>'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">GRANT</span> BACKUP_ADMIN <span class="token keyword">on</span> <span class="token operator">*</span><span class="token punctuation">.</span><span class="token operator">*</span> <span class="token keyword">to</span> <span class="token string">'donor_clone_user'</span>@<span class="token string">'example.donor.host.com'</span><span class="token punctuation">;</span></code></pre>
         </div>
        </li>
        <li class="listitem">
         <p>
          Install the clone plugin:
         </p>
         <div class="copytoclipboard-wrapper">
          <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa20018049"><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">INSTALL</span> <span class="token keyword">PLUGIN</span> <span class="token keyword">clone</span> <span class="token keyword">SONAME</span> <span class="token string">'mysql_clone.so'</span><span class="token punctuation">;</span></code></pre>
         </div>
        </li>
       </ol>
      </div>
     </li>
     <li class="listitem">
      <p>
       Login to the recipient MySQL server instance with an
              administrative user account.
      </p>
      <div class="orderedlist">
       <ol class="orderedlist" type="a">
        <li class="listitem">
         <p>
          Create a clone user with the
          <a class="link" href="privileges-provided.html#priv_clone-admin">
           <code class="literal">
            CLONE_ADMIN
           </code>
          </a>
          privilege.
         </p>
         <div class="copytoclipboard-wrapper">
          <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa51786768"><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">CREATE</span> <span class="token keyword">USER</span> <span class="token string">'recipient_clone_user'</span>@<span class="token string">'example.recipient.host.com'</span> <span class="token keyword">IDENTIFIED</span> <span class="token keyword">BY</span> <span class="token string">'<em class="replaceable">password</em>'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">GRANT</span> CLONE_ADMIN <span class="token keyword">on</span> <span class="token operator">*</span><span class="token punctuation">.</span><span class="token operator">*</span> <span class="token keyword">to</span> <span class="token string">'recipient_clone_user'</span>@<span class="token string">'example.recipient.host.com'</span><span class="token punctuation">;</span></code></pre>
         </div>
        </li>
        <li class="listitem">
         <p>
          Install the clone plugin:
         </p>
         <div class="copytoclipboard-wrapper">
          <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa10897120"><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">INSTALL</span> <span class="token keyword">PLUGIN</span> <span class="token keyword">clone</span> <span class="token keyword">SONAME</span> <span class="token string">'mysql_clone.so'</span><span class="token punctuation">;</span></code></pre>
         </div>
        </li>
        <li class="listitem">
         <p>
          Add the host address of the donor MySQL server
                  instance to the
          <a class="link" href="clone-plugin-options-variables.html#sysvar_clone_valid_donor_list">
           <code class="literal">
            clone_valid_donor_list
           </code>
          </a>
          variable setting.
         </p>
         <div class="copytoclipboard-wrapper">
          <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa44932794"><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> clone_valid_donor_list <span class="token operator">=</span> <span class="token string">'<em class="replaceable">example.donor.host.com</em>:<em class="replaceable">3306</em>'</span><span class="token punctuation">;</span></code></pre>
         </div>
        </li>
       </ol>
      </div>
     </li>
     <li class="listitem">
      <p>
       Log on to the recipient MySQL server instance as the clone
              user you created previously
              (
       <code class="literal">
        recipient_clone_user'@'example.recipient.host.com
       </code>
       )
              and execute the
       <a class="link" href="clone.html" title="15.7.5 CLONE Statement">
        <code class="literal">
         CLONE
              INSTANCE
        </code>
       </a>
       statement.
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa69649039"><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">CLONE</span> <span class="token keyword">INSTANCE</span> <span class="token keyword">FROM</span> <span class="token string">'donor_clone_user'</span>@<span class="token string">'example.donor.host.com'</span>:<span class="token number">3306</span>
       <span class="token keyword">IDENTIFIED</span> <span class="token keyword">BY</span> <span class="token string">'<em class="replaceable">password</em>'</span><span class="token punctuation">;</span></code></pre>
      </div>
      <p>
       After the data is cloned, the MySQL server instance on the
              recipient is restarted automatically.
      </p>
      <p>
       For information about monitoring cloning operation status
              and progress, see
       <a class="xref" href="clone-plugin-monitoring.html" title="7.6.7.10 Monitoring Cloning Operations">
        Section 7.6.7.10, “Monitoring Cloning Operations”
       </a>
       .
      </p>
     </li>
    </ol>
   </div>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="clone-plugin-remote-named-directory">
       </a>
       Cloning to a Named Directory
      </h5>
     </div>
    </div>
   </div>
   <a class="indexterm" name="idm46045255489136">
   </a>
   <p>
    By default, a remote cloning operation removes user-created
          data (schemas, tables, tablespaces) and binary logs from the
          recipient data directory before cloning data from the donor
          MySQL Server instance. By cloning to a named directory, you
          can avoid removing data from the current recipient data
          directory.
   </p>
   <p>
    The procedure for cloning to a named directory is the same
          procedure described in
    <a class="xref" href="clone-plugin-remote.html#clone-plugin-remote-example" title="Cloning Remote Data">
     Cloning Remote Data
    </a>
    with one
          exception: The
    <a class="link" href="clone.html" title="15.7.5 CLONE Statement">
     <code class="literal">
      CLONE
          INSTANCE
     </code>
    </a>
    statement must include the
    <code class="literal">
     DATA
          DIRECTORY
    </code>
    clause. For example:
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa96341863"><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">CLONE</span> <span class="token keyword">INSTANCE</span> <span class="token keyword">FROM</span> <span class="token string">'<em class="replaceable">user</em>'</span>@<span class="token string">'<em class="replaceable">example.donor.host.com</em>'</span>:<span class="token number"><em class="replaceable">3306</em></span>
       <span class="token keyword">IDENTIFIED</span> <span class="token keyword">BY</span> <span class="token string">'<em class="replaceable">password</em>'</span>
       <span class="token keyword">DATA</span> <span class="token keyword">DIRECTORY</span> <span class="token operator">=</span> <span class="token string">'<em class="replaceable">/path/to/clone_dir</em>'</span><span class="token punctuation">;</span></code></pre>
   </div>
   <p>
    An absolute path is required, and the directory must not
          exist. The MySQL server must have the necessary write access
          to create the directory.
   </p>
   <p>
    When cloning to a named directory, the recipient MySQL server
          instance is not restarted automatically after the data is
          cloned. If you want to restart the MySQL server on the named
          directory, you must do so manually:
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa87325247"><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"><span class="token prompt">$&gt; </span><span class="token command">mysqld_safe</span> <span class="token constant">--datadir</span><span class="token attr-value"><span class="token punctuation">=</span><em class="replaceable">/path/to/clone_dir</em></span></code></pre>
   </div>
   <p>
    where
    <em class="replaceable">
     <code>
      /path/to/clone_dir
     </code>
    </em>
    is the
          path to the named directory on the recipient.
   </p>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="clone-plugin-remote-ssl">
       </a>
       Configuring an Encrypted Connection for Cloning
      </h5>
     </div>
    </div>
   </div>
   <a class="indexterm" name="idm46045255475440">
   </a>
   <p>
    You can configure an encrypted connection for remote cloning
          operations to protect data as it is cloned over the network.
          An encrypted connection is required by default when cloning
          encrypted data. (see
    <a class="xref" href="clone-plugin-encrypted-data.html" title="7.6.7.5 Cloning Encrypted Data">
     Section 7.6.7.5, “Cloning Encrypted Data”
    </a>
    .)
   </p>
   <p>
    The instructions that follow describe how to configure the
          recipient MySQL server instance to use an encrypted
          connection. It is assumed that the donor MySQL server instance
          is already configured to use encrypted connections. If not,
          refer to
    <a class="xref" href="using-encrypted-connections.html" title="8.3.1 Configuring MySQL to Use Encrypted Connections">
     Section 8.3.1, “Configuring MySQL to Use Encrypted Connections”
    </a>
    for
          server-side configuration instructions.
   </p>
   <p>
    To configure the recipient MySQL server instance to use an
          encrypted connection:
   </p>
   <div class="orderedlist">
    <ol class="orderedlist" type="1">
     <li class="listitem">
      <p>
       Make the client certificate and key files of the donor
              MySQL server instance available to the recipient host.
              Either distribute the files to the recipient host using a
              secure channel or place them on a mounted partition that
              is accessible to the recipient host. The client
              certificate and key files to make available include:
      </p>
      <div class="itemizedlist">
       <ul class="itemizedlist" style="list-style-type: disc; ">
        <li class="listitem">
         <p>
          <code class="filename">
           ca.pem
          </code>
         </p>
         <p>
          The self-signed certificate authority (CA) file.
         </p>
        </li>
        <li class="listitem">
         <p>
          <code class="filename">
           client-cert.pem
          </code>
         </p>
         <p>
          The client public key certificate file.
         </p>
        </li>
        <li class="listitem">
         <p>
          <code class="filename">
           client-key.pem
          </code>
         </p>
         <p>
          The client private key file.
         </p>
        </li>
       </ul>
      </div>
     </li>
     <li class="listitem">
      <p>
       Configure the following SSL options on the recipient MySQL
              server instance.
      </p>
      <div class="itemizedlist">
       <ul class="itemizedlist" style="list-style-type: disc; ">
        <li class="listitem">
         <p>
          <a class="link" href="clone-plugin-options-variables.html#sysvar_clone_ssl_ca">
           <code class="literal">
            clone_ssl_ca
           </code>
          </a>
         </p>
         <p>
          Specifies the path to the self-signed certificate
                  authority (CA) file.
         </p>
        </li>
        <li class="listitem">
         <p>
          <a class="link" href="clone-plugin-options-variables.html#sysvar_clone_ssl_cert">
           <code class="literal">
            clone_ssl_cert
           </code>
          </a>
         </p>
         <p>
          Specifies the path to the client public key
                  certificate file.
         </p>
        </li>
        <li class="listitem">
         <p>
          <a class="link" href="clone-plugin-options-variables.html#sysvar_clone_ssl_key">
           <code class="literal">
            clone_ssl_key
           </code>
          </a>
         </p>
         <p>
          Specifies the path to the client private key file.
         </p>
        </li>
       </ul>
      </div>
      <p>
       For example:
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-ini"><div class="docs-select-all right" id="sa44394653"><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">clone_ssl_ca</span><span class="token attr-value"><span class="token punctuation">=</span>/<em class="replaceable">path</em>/<em class="replaceable">to</em>/ca.pem</span>
<span class="token constant">clone_ssl_cert</span><span class="token attr-value"><span class="token punctuation">=</span>/<em class="replaceable">path</em>/<em class="replaceable">to</em>/client-cert.pem</span>
<span class="token constant">clone_ssl_key</span><span class="token attr-value"><span class="token punctuation">=</span>/<em class="replaceable">path</em>/<em class="replaceable">to</em>/client-key.pem</span></code></pre>
      </div>
     </li>
     <li class="listitem">
      <p>
       To require that an encrypted connection is used, include
              the
       <code class="literal">
        REQUIRE SSL
       </code>
       clause when issuing the
       <a class="link" href="clone.html" title="15.7.5 CLONE Statement">
        <code class="literal">
         CLONE
        </code>
       </a>
       statement on the
              recipient.
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa46693073"><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">CLONE</span> <span class="token keyword">INSTANCE</span> <span class="token keyword">FROM</span> <span class="token string">'<em class="replaceable">user</em>'</span>@<span class="token string">'<em class="replaceable">example.donor.host.com</em>'</span>:<span class="token number"><em class="replaceable">3306</em></span>
       <span class="token keyword">IDENTIFIED</span> <span class="token keyword">BY</span> <span class="token string">'<em class="replaceable">password</em>'</span>
       <span class="token keyword">DATA</span> <span class="token keyword">DIRECTORY</span> <span class="token operator">=</span> <span class="token string">'<em class="replaceable">/path/to/clone_dir</em>'</span>
       <span class="token keyword">REQUIRE</span> <span class="token keyword">SSL</span><span class="token punctuation">;</span></code></pre>
      </div>
      <p>
       If an SSL clause is not specified, the clone plugin
              attempts to establish an encrypted connection by default,
              falling back to an unencrypted connection if the encrypted
              connection attempt fails.
      </p>
      <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
       <div class="admon-title">
        Note
       </div>
       <p>
        If you are cloning encrypted data, an encrypted
                connection is required by default regardless of whether
                the
        <code class="literal">
         REQUIRE SSL
        </code>
        clause is specified.
                Using
        <code class="literal">
         REQUIRE NO SSL
        </code>
        causes an error
                if you attempt to clone encrypted data.
       </p>
      </div>
     </li>
    </ol>
   </div>
  </div>
 </div>
 <br/>
</div>
