<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h3 class="title">
      <a name="mysql-cluster-single-user-mode">
      </a>
      25.6.6 NDB Cluster Single User Mode
     </h3>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045092503392">
  </a>
  <a class="indexterm" name="idm46045092501904">
  </a>
  <p>
   <span class="firstterm">
    Single user mode
   </span>
   enables the
      database administrator to restrict access to the database system
      to a single API node, such as a MySQL server (SQL node) or an
      instance of
   <a class="link" href="mysql-cluster-programs-ndb-restore.html" title="25.5.23 ndb_restore — Restore an NDB Cluster Backup">
    <span class="command">
     <strong>
      ndb_restore
     </strong>
    </span>
   </a>
   . When entering single
      user mode, connections to all other API nodes are closed
      gracefully and all running transactions are aborted. No new
      transactions are permitted to start.
  </p>
  <p>
   Once the cluster has entered single user mode, only the designated
      API node is granted access to the database.
  </p>
  <p>
   You can use the
   <code class="literal">
    ALL STATUS
   </code>
   command in the
   <a class="link" href="mysql-cluster-programs-ndb-mgm.html" title="25.5.5 ndb_mgm — The NDB Cluster Management Client">
    <span class="command">
     <strong>
      ndb_mgm
     </strong>
    </span>
   </a>
   client to see when the cluster has
      entered single user mode. You can also check the
   <code class="literal">
    status
   </code>
   column of the
   <a class="link" href="mysql-cluster-ndbinfo-nodes.html" title="25.6.17.48 The ndbinfo nodes Table">
    <code class="literal">
     ndbinfo.nodes
    </code>
   </a>
   table (see
   <a class="xref" href="mysql-cluster-ndbinfo-nodes.html" title="25.6.17.48 The ndbinfo nodes Table">
    Section 25.6.17.48, “The ndbinfo nodes Table”
   </a>
   , for more
      information).
  </p>
  <p>
   Example:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting one-line language-ndbmgm"><div class="docs-select-all right" id="sa95678237"><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-ndbmgm"><span class="token prompt">ndb_mgm&gt;</span> <span class="token keyword">ENTER SINGLE USER MODE</span> 5</code></pre>
  </div>
  <p>
   After this command has executed and the cluster has entered single
      user mode, the API node whose node ID is
   <code class="literal">
    5
   </code>
   becomes the cluster's only permitted user.
  </p>
  <p>
   The node specified in the preceding command must be an API node;
      attempting to specify any other type of node is rejected.
  </p>
  <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
   <div class="admon-title">
    Note
   </div>
   <p>
    When the preceding command is invoked, all transactions running
        on the designated node are aborted, the connection is closed,
        and the server must be restarted.
   </p>
  </div>
  <p>
   The command
   <code class="literal">
    EXIT SINGLE USER MODE
   </code>
   changes the
      state of the cluster's data nodes from single user mode to
      normal mode. API nodes—such as MySQL Servers—waiting
      for a connection (that is, waiting for the cluster to become ready
      and available), are again permitted to connect. The API node
      denoted as the single-user node continues to run (if still
      connected) during and after the state change.
  </p>
  <p>
   Example:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting one-line language-ndbmgm"><div class="docs-select-all right" id="sa91001271"><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-ndbmgm"><span class="token prompt">ndb_mgm&gt;</span> <span class="token keyword">EXIT SINGLE USER MODE</span></code></pre>
  </div>
  <a class="indexterm" name="idm46045092483568">
  </a>
  <p>
   There are two recommended ways to handle a node failure when
      running in single user mode:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      Method 1:
     </p>
     <div class="orderedlist">
      <ol class="orderedlist" type="1">
       <li class="listitem">
        <p>
         Finish all single user mode transactions
        </p>
       </li>
       <li class="listitem">
        <p>
         Issue the
         <code class="literal">
          EXIT SINGLE USER MODE
         </code>
         command
        </p>
       </li>
       <li class="listitem">
        <p>
         Restart the cluster's data nodes
        </p>
       </li>
      </ol>
     </div>
    </li>
    <li class="listitem">
     <p>
      Method 2:
     </p>
     <p>
      Restart storage nodes prior to entering single user mode.
     </p>
    </li>
   </ul>
  </div>
 </div>
 <br/>
</div>
