<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h3 class="title">
      <a name="mysql-cluster-mysqld">
      </a>
      25.6.10 MySQL Server Usage for NDB Cluster
     </h3>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045091812240">
  </a>
  <a class="indexterm" name="idm46045091810784">
  </a>
  <a class="indexterm" name="idm46045091809296">
  </a>
  <a class="indexterm" name="idm46045091807808">
  </a>
  <a class="indexterm" name="idm46045091806736">
  </a>
  <p>
   <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
    <span class="command">
     <strong>
      mysqld
     </strong>
    </span>
   </a>
   is the traditional MySQL server process.
      To be used with NDB Cluster,
   <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
    <span class="command">
     <strong>
      mysqld
     </strong>
    </span>
   </a>
   needs to be
      built with support for the
   <a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
    <code class="literal">
     NDB
    </code>
   </a>
   storage engine, as it is in the precompiled binaries available
      from
   <a class="ulink" href="https://dev.mysql.com/downloads/" target="_top">
    https://dev.mysql.com/downloads/
   </a>
   . If you build MySQL from
      source, you must invoke
   <span class="command">
    <strong>
     CMake
    </strong>
   </span>
   with the
   <a class="link" href="source-configuration-options.html#option_cmake_with_ndb">
    <code class="option">
     -DWITH_NDB=1
    </code>
   </a>
   or (deprecated)
   <a class="link" href="source-configuration-options.html#option_cmake_with_ndbcluster">
    <code class="option">
     -DWITH_NDBCLUSTER=1
    </code>
   </a>
   option to
      include support for
   <code class="literal">
    NDB
   </code>
   .
  </p>
  <p>
   For more information about compiling NDB Cluster from source, see
   <a class="xref" href="mysql-cluster-install-linux-source.html" title="25.3.1.4 Building NDB Cluster from Source on Linux">
    Section 25.3.1.4, “Building NDB Cluster from Source on Linux”
   </a>
   , and
   <a class="xref" href="mysql-cluster-install-windows-source.html" title="25.3.2.2 Compiling and Installing NDB Cluster from Source on Windows">
    Section 25.3.2.2, “Compiling and Installing NDB Cluster from Source on Windows”
   </a>
   .
  </p>
  <p>
   (For information about
   <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
    <span class="command">
     <strong>
      mysqld
     </strong>
    </span>
   </a>
   options and
      variables, in addition to those discussed in this section, which
      are relevant to NDB Cluster, see
   <a class="xref" href="mysql-cluster-options-variables.html" title="25.4.3.9 MySQL Server Options and Variables for NDB Cluster">
    Section 25.4.3.9, “MySQL Server Options and Variables for NDB Cluster”
   </a>
   .)
  </p>
  <p>
   If the
   <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
    <span class="command">
     <strong>
      mysqld
     </strong>
    </span>
   </a>
   binary has been built with
      Cluster support, the
   <a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
    <code class="literal">
     NDBCLUSTER
    </code>
   </a>
   storage engine is still disabled by default. You can use either of
      two possible options to enable this engine:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      Use
      <a class="link" href="mysql-cluster-options-variables.html#option_mysqld_ndbcluster">
       <code class="option">
        --ndbcluster
       </code>
      </a>
      as a startup
          option on the command line when starting
      <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
       <span class="command">
        <strong>
         mysqld
        </strong>
       </span>
      </a>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      Insert a line containing
      <code class="literal">
       ndbcluster
      </code>
      in the
      <code class="literal">
       [mysqld]
      </code>
      section of your
      <code class="filename">
       my.cnf
      </code>
      file.
     </p>
    </li>
   </ul>
  </div>
  <p>
   An easy way to verify that your server is running with the
   <a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
    <code class="literal">
     NDBCLUSTER
    </code>
   </a>
   storage engine enabled is
      to issue the
   <a class="link" href="show-engines.html" title="15.7.7.17 SHOW ENGINES Statement">
    <code class="literal">
     SHOW ENGINES
    </code>
   </a>
   statement
      in the MySQL Monitor (
   <a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
    <span class="command">
     <strong>
      mysql
     </strong>
    </span>
   </a>
   ). You should see
      the value
   <code class="literal">
    YES
   </code>
   as the
   <code class="literal">
    Support
   </code>
   value in the row for
   <a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
    <code class="literal">
     NDBCLUSTER
    </code>
   </a>
   . If
      you see
   <code class="literal">
    NO
   </code>
   in this row or if there is no such
      row displayed in the output, you are not running an
   <a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
    <code class="literal">
     NDB
    </code>
   </a>
   -enabled version of MySQL. If you
      see
   <code class="literal">
    DISABLED
   </code>
   in this row, you need to enable it
      in either one of the two ways just described.
  </p>
  <a class="indexterm" name="idm46045091773424">
  </a>
  <a class="indexterm" name="idm46045091771936">
  </a>
  <a class="indexterm" name="idm46045091770864">
  </a>
  <p>
   To read cluster configuration data, the MySQL server requires at a
      minimum three pieces of information:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      The MySQL server's own cluster node ID
     </p>
    </li>
    <li class="listitem">
     <p>
      The host name or IP address for the management server
     </p>
    </li>
    <li class="listitem">
     <p>
      The number of the TCP/IP port on which it can connect to the
          management server
     </p>
    </li>
   </ul>
  </div>
  <p>
   Node IDs can be allocated dynamically, so it is not strictly
      necessary to specify them explicitly.
  </p>
  <p>
   The
   <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
    <span class="command">
     <strong>
      mysqld
     </strong>
    </span>
   </a>
   parameter
   <code class="literal">
    ndb-connectstring
   </code>
   is used to specify the
      connection string either on the command line when starting
   <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
    <span class="command">
     <strong>
      mysqld
     </strong>
    </span>
   </a>
   or in
   <code class="filename">
    my.cnf
   </code>
   . The
      connection string contains the host name or IP address where the
      management server can be found, as well as the TCP/IP port it
      uses.
  </p>
  <p>
   In the following example,
   <code class="literal">
    ndb_mgmd.mysql.com
   </code>
   is
      the host where the management server resides, and the management
      server listens for cluster messages on port 1186:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa84174613"><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</span> <span class="token property">--ndbcluster</span> <span class="token constant">--ndb-connectstring</span><span class="token attr-value"><span class="token punctuation">=</span>ndb_mgmd.mysql.com:1186</span></code></pre>
  </div>
  <p>
   See
   <a class="xref" href="mysql-cluster-connection-strings.html" title="25.4.3.3 NDB Cluster Connection Strings">
    Section 25.4.3.3, “NDB Cluster Connection Strings”
   </a>
   , for more
      information on connection strings.
  </p>
  <p>
   Given this information, the MySQL server can act as a full
      participant in the cluster. (We often refer to a
   <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
    <span class="command">
     <strong>
      mysqld
     </strong>
    </span>
   </a>
   process running in this manner as an SQL
      node.) It is fully aware of all cluster data nodes as well as
      their status, and establishes connections to all data nodes. In
      this case, it is able to use any data node as a transaction
      coordinator and to read and update node data.
  </p>
  <p>
   You can see in the
   <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 whether a MySQL
      server is connected to the cluster using
   <a class="link" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
    <code class="literal">
     SHOW
      PROCESSLIST
    </code>
   </a>
   . If the MySQL server is connected to the
      cluster, and you have the
   <a class="link" href="privileges-provided.html#priv_process">
    <code class="literal">
     PROCESS
    </code>
   </a>
   privilege, then the first row of the output is as shown here:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa37450626"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SHOW</span> <span class="token keyword">PROCESSLIST</span> \G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
     Id<span class="token punctuation">:</span> 1
   User<span class="token punctuation">:</span> system user
   Host<span class="token punctuation">:</span>
     db<span class="token punctuation">:</span>
Command<span class="token punctuation">:</span> Daemon
   Time<span class="token punctuation">:</span> 1
  State<span class="token punctuation">:</span> Waiting for event from ndbcluster
   Info<span class="token punctuation">:</span> NULL</span></code></pre>
  </div>
  <div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
   <div class="admon-title">
    Important
   </div>
   <p>
    To participate in an NDB Cluster, the
    <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
     <span class="command">
      <strong>
       mysqld
      </strong>
     </span>
    </a>
    process must be started with
    <span class="emphasis">
     <em>
      both
     </em>
    </span>
    the
        options
    <a class="link" href="mysql-cluster-options-variables.html#option_mysqld_ndbcluster">
     <code class="option">
      --ndbcluster
     </code>
    </a>
    and
    <a class="link" href="mysql-cluster-options-variables.html#option_mysqld_ndb-connectstring">
     <code class="option">
      --ndb-connectstring
     </code>
    </a>
    (or their
        equivalents in
    <code class="filename">
     my.cnf
    </code>
    ). If
    <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
     <span class="command">
      <strong>
       mysqld
      </strong>
     </span>
    </a>
    is started with only the
    <a class="link" href="mysql-cluster-options-variables.html#option_mysqld_ndbcluster">
     <code class="option">
      --ndbcluster
     </code>
    </a>
    option, or if it is
        unable to contact the cluster, it is not possible to work with
    <a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
     <code class="literal">
      NDB
     </code>
    </a>
    tables,
    <span class="emphasis">
     <em>
      nor is it
        possible to create any new tables regardless of storage
        engine
     </em>
    </span>
    . The latter restriction is a safety measure
        intended to prevent the creation of tables having the same names
        as
    <a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
     <code class="literal">
      NDB
     </code>
    </a>
    tables while the SQL node is
        not connected to the cluster. If you wish to create tables using
        a different storage engine while the
    <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
     <span class="command">
      <strong>
       mysqld
      </strong>
     </span>
    </a>
    process is not participating in an NDB Cluster, you must restart
        the server
    <span class="emphasis">
     <em>
      without
     </em>
    </span>
    the
    <a class="link" href="mysql-cluster-options-variables.html#option_mysqld_ndbcluster">
     <code class="option">
      --ndbcluster
     </code>
    </a>
    option.
   </p>
  </div>
 </div>
 <br/>
</div>
