<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="mysql-cluster-install-windows-service">
      </a>
      25.3.2.4 Installing NDB Cluster Processes as Windows Services
     </h4>
    </div>
   </div>
  </div>
  <p>
   Once you are satisfied that NDB Cluster is running as desired,
        you can install the management nodes and data nodes as Windows
        services, so that these processes are started and stopped
        automatically whenever Windows is started or stopped. This also
        makes it possible to control these processes from the command
        line with the appropriate
   <span class="command">
    <strong>
     SC START
    </strong>
   </span>
   and
   <span class="command">
    <strong>
     SC STOP
    </strong>
   </span>
   commands, or using the Windows
        graphical
   <span class="command">
    <strong>
     Services
    </strong>
   </span>
   utility.
   <span class="command">
    <strong>
     NET
        START
    </strong>
   </span>
   and
   <span class="command">
    <strong>
     NET STOP
    </strong>
   </span>
   commands can
        also be used.
  </p>
  <p>
   Installing programs as Windows services usually must be done
        using an account that has Administrator rights on the system.
  </p>
  <p>
   To install the management node as a service on Windows, invoke
   <a class="link" href="mysql-cluster-programs-ndb-mgmd.html" title="25.5.4 ndb_mgmd — The NDB Cluster Management Server Daemon">
    <span class="command">
     <strong>
      ndb_mgmd.exe
     </strong>
    </span>
   </a>
   from the command line on the
        machine hosting the management node, using the
   <a class="link" href="mysql-cluster-programs-ndb-mgmd.html#option_ndb_mgmd_install">
    <code class="option">
     --install
    </code>
   </a>
   option, as shown
        here:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa23509099"><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">C:\&gt;</span><span class="token command"> C:\mysql\bin\ndb_mgmd.exe</span> <span class="token property">--install</span>
Installing service <span class="token atrule">'NDB Cluster Management Server'</span>
  as <span class="token atrule">'"C:\mysql\bin\ndbd.exe" "--service=ndb_mgmd"'</span>
Service successfully installed<span class="token punctuation">.</span></code></pre>
  </div>
  <div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
   <div class="admon-title">
    Important
   </div>
   <p>
    When installing an NDB Cluster program as a Windows service,
          you should always specify the complete path; otherwise the
          service installation may fail with the error
    <span class="errortext">
     The
          system cannot find the file specified
    </span>
    .
   </p>
  </div>
  <p>
   The
   <a class="link" href="mysql-cluster-programs-ndb-mgmd.html#option_ndb_mgmd_install">
    <code class="option">
     --install
    </code>
   </a>
   option must be
        used first, ahead of any other options that might be specified
        for
   <a class="link" href="mysql-cluster-programs-ndb-mgmd.html" title="25.5.4 ndb_mgmd — The NDB Cluster Management Server Daemon">
    <span class="command">
     <strong>
      ndb_mgmd.exe
     </strong>
    </span>
   </a>
   . However, it is preferable
        to specify such options in an options file instead. If your
        options file is not in one of the default locations as shown in
        the output of
   <a class="link" href="mysql-cluster-programs-ndb-mgmd.html" title="25.5.4 ndb_mgmd — The NDB Cluster Management Server Daemon">
    <span class="command">
     <strong>
      ndb_mgmd.exe
     </strong>
    </span>
   </a>
   <a class="link" href="mysql-cluster-programs-ndb-mgmd.html#option_ndb_mgmd_help">
    <code class="option">
     --help
    </code>
   </a>
   , you can specify the
        location using the
   <a class="link" href="mysql-cluster-programs-ndb-mgmd.html#option_ndb_mgmd_config-file">
    <code class="option">
     --config-file
    </code>
   </a>
   option.
  </p>
  <p>
   Now you should be able to start and stop the management server
        like this:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa38166478"><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">C:\&gt;</span><span class="token command"> SC</span> START ndb_mgmd

<span class="token prompt">C:\&gt;</span><span class="token command"> SC</span> STOP ndb_mgmd</code></pre>
  </div>
  <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
   <div class="admon-title">
    Note
   </div>
   <p>
    If using
    <span class="command">
     <strong>
      NET
     </strong>
    </span>
    commands, you can also start
          or stop the management server as a Windows service using the
          descriptive name, as shown here:
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa76558538"><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">C:\&gt;</span><span class="token command"> NET</span> START <span class="token atrule">'NDB Cluster Management Server'</span>
The NDB Cluster Management Server service is starting<span class="token punctuation">.</span>
The NDB Cluster Management Server service was started successfully<span class="token punctuation">.</span>

<span class="token prompt">C:\&gt;</span><span class="token command"> NET</span> STOP  <span class="token atrule">'NDB Cluster Management Server'</span>
The NDB Cluster Management Server service is stopping<span class="token punctuation">.</span><span class="token punctuation">.</span>
The NDB Cluster Management Server service was stopped successfully<span class="token punctuation">.</span></code></pre>
   </div>
  </div>
  <p>
   It is usually simpler to specify a short service name or to
        permit the default service name to be used when installing the
        service, and then reference that name when starting or stopping
        the service. To specify a service name other than
   <code class="literal">
    ndb_mgmd
   </code>
   , append it to the
   <a class="link" href="mysql-cluster-programs-ndb-mgmd.html#option_ndb_mgmd_install">
    <code class="option">
     --install
    </code>
   </a>
   option, as shown in
        this example:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa89864735"><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">C:\&gt;</span><span class="token command"> C:\mysql\bin\ndb_mgmd.exe</span> <span class="token constant">--install</span><span class="token attr-value"><span class="token punctuation">=</span>mgmd1</span>
Installing service <span class="token atrule">'NDB Cluster Management Server'</span>
  as <span class="token atrule">'"C:\mysql\bin\ndb_mgmd.exe" "--service=mgmd1"'</span>
Service successfully installed<span class="token punctuation">.</span></code></pre>
  </div>
  <p>
   Now you should be able to start or stop the service using the
        name you have specified, like this:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa58973715"><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">C:\&gt;</span><span class="token command"> SC</span> START mgmd1

<span class="token prompt">C:\&gt;</span><span class="token command"> SC</span> STOP mgmd1</code></pre>
  </div>
  <p>
   To remove the management node service, use
   <span class="command">
    <strong>
     SC DELETE
     <em class="replaceable">
      <code>
       service_name
      </code>
     </em>
    </strong>
   </span>
   :
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa77968595"><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">C:\&gt;</span><span class="token command"> SC</span> DELETE mgmd1</code></pre>
  </div>
  <p>
   Alternatively, invoke
   <a class="link" href="mysql-cluster-programs-ndb-mgmd.html" title="25.5.4 ndb_mgmd — The NDB Cluster Management Server Daemon">
    <span class="command">
     <strong>
      ndb_mgmd.exe
     </strong>
    </span>
   </a>
   with the
   <a class="link" href="mysql-cluster-programs-ndb-mgmd.html#option_ndb_mgmd_remove">
    <code class="option">
     --remove
    </code>
   </a>
   option, as shown here:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa64660525"><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">C:\&gt;</span><span class="token command"> C:\mysql\bin\ndb_mgmd.exe</span> <span class="token property">--remove</span>
Removing service <span class="token atrule">'NDB Cluster Management Server'</span>
Service successfully removed<span class="token punctuation">.</span></code></pre>
  </div>
  <p>
   If you installed the service using a service name other than the
        default, pass the service name as the value of the
   <a class="link" href="mysql-cluster-programs-ndb-mgmd.html" title="25.5.4 ndb_mgmd — The NDB Cluster Management Server Daemon">
    <span class="command">
     <strong>
      ndb_mgmd.exe
     </strong>
    </span>
   </a>
   <a class="link" href="mysql-cluster-programs-ndb-mgmd.html#option_ndb_mgmd_remove">
    <code class="option">
     --remove
    </code>
   </a>
   option, like this:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa96627875"><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">C:\&gt;</span><span class="token command"> C:\mysql\bin\ndb_mgmd.exe</span> <span class="token constant">--remove</span><span class="token attr-value"><span class="token punctuation">=</span>mgmd1</span>
Removing service <span class="token atrule">'mgmd1'</span>
Service successfully removed<span class="token punctuation">.</span></code></pre>
  </div>
  <p>
   Installation of an NDB Cluster data node process as a Windows
        service can be done in a similar fashion, using the
   <a class="link" href="mysql-cluster-programs-ndbd.html#option_ndbd_install">
    <code class="option">
     --install
    </code>
   </a>
   option for
   <a class="link" href="mysql-cluster-programs-ndbd.html" title="25.5.1 ndbd — The NDB Cluster Data Node Daemon">
    <span class="command">
     <strong>
      ndbd.exe
     </strong>
    </span>
   </a>
   (or
   <a class="link" href="mysql-cluster-programs-ndbmtd.html" title="25.5.3 ndbmtd — The NDB Cluster Data Node Daemon (Multi-Threaded)">
    <span class="command">
     <strong>
      ndbmtd.exe
     </strong>
    </span>
   </a>
   ),
        as shown here:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa57551560"><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">C:\&gt;</span><span class="token command"> C:\mysql\bin\ndbd.exe</span> <span class="token property">--install</span>
Installing service <span class="token atrule">'NDB Cluster Data Node Daemon'</span> as <span class="token atrule">'"C:\mysql\bin\ndbd.exe" "--service=ndbd"'</span>
Service successfully installed<span class="token punctuation">.</span></code></pre>
  </div>
  <p>
   Now you can start or stop the data node as shown in the
        following example:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa69049285"><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">C:\&gt;</span><span class="token command"> SC</span> START ndbd

<span class="token prompt">C:\&gt;</span><span class="token command"> SC</span> STOP ndbd</code></pre>
  </div>
  <p>
   To remove the data node service, use
   <span class="command">
    <strong>
     SC DELETE
     <em class="replaceable">
      <code>
       service_name
      </code>
     </em>
    </strong>
   </span>
   :
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa73492308"><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">C:\&gt;</span><span class="token command"> SC</span> DELETE ndbd</code></pre>
  </div>
  <p>
   Alternatively, invoke
   <a class="link" href="mysql-cluster-programs-ndbd.html" title="25.5.1 ndbd — The NDB Cluster Data Node Daemon">
    <span class="command">
     <strong>
      ndbd.exe
     </strong>
    </span>
   </a>
   with the
   <a class="link" href="mysql-cluster-programs-ndbd.html#option_ndbd_remove">
    <code class="option">
     --remove
    </code>
   </a>
   option, as shown here:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa43987674"><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">C:\&gt;</span><span class="token command"> C:\mysql\bin\ndbd.exe</span> <span class="token property">--remove</span>
Removing service <span class="token atrule">'NDB Cluster Data Node Daemon'</span>
Service successfully removed<span class="token punctuation">.</span></code></pre>
  </div>
  <p>
   As with
   <a class="link" href="mysql-cluster-programs-ndb-mgmd.html" title="25.5.4 ndb_mgmd — The NDB Cluster Management Server Daemon">
    <span class="command">
     <strong>
      ndb_mgmd.exe
     </strong>
    </span>
   </a>
   (and
   <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
    <span class="command">
     <strong>
      mysqld.exe
     </strong>
    </span>
   </a>
   ), when installing
   <a class="link" href="mysql-cluster-programs-ndbd.html" title="25.5.1 ndbd — The NDB Cluster Data Node Daemon">
    <span class="command">
     <strong>
      ndbd.exe
     </strong>
    </span>
   </a>
   as a Windows service, you can also
        specify a name for the service as the value of
   <a class="link" href="mysql-cluster-programs-ndbd.html#option_ndbd_install">
    <code class="option">
     --install
    </code>
   </a>
   , and then use it when
        starting or stopping the service, like this:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa69814676"><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">C:\&gt;</span><span class="token command"> C:\mysql\bin\ndbd.exe</span> <span class="token constant">--install</span><span class="token attr-value"><span class="token punctuation">=</span>dnode1</span>
Installing service <span class="token atrule">'dnode1'</span> as <span class="token atrule">'"C:\mysql\bin\ndbd.exe" "--service=dnode1"'</span>
Service successfully installed<span class="token punctuation">.</span>

<span class="token prompt">C:\&gt;</span><span class="token command"> SC</span> START dnode1

<span class="token prompt">C:\&gt;</span><span class="token command"> SC</span> STOP dnode1</code></pre>
  </div>
  <p>
   If you specified a service name when installing the data node
        service, you can use this name when removing it as well, as
        shown here:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa24448932"><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">C:\&gt;</span><span class="token command"> SC</span> DELETE dnode1</code></pre>
  </div>
  <p>
   Alternatively, you can pass the service name as the value of the
   <code class="filename">
    ndbd.exe
   </code>
   <a class="link" href="mysql-cluster-programs-ndbd.html#option_ndbd_remove">
    <code class="option">
     --remove
    </code>
   </a>
   option, as shown here:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa91862922"><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">C:\&gt;</span><span class="token command"> C:\mysql\bin\ndbd.exe</span> <span class="token constant">--remove</span><span class="token attr-value"><span class="token punctuation">=</span>dnode1</span>
Removing service <span class="token atrule">'dnode1'</span>
Service successfully removed<span class="token punctuation">.</span></code></pre>
  </div>
  <p>
   Installation of the SQL node as a Windows service, starting the
        service, stopping the service, and removing the service are done
        in a similar fashion, using
   <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
    <span class="command">
     <strong>
      mysqld
     </strong>
    </span>
   </a>
   <code class="option">
    --install
   </code>
   ,
   <span class="command">
    <strong>
     SC START
    </strong>
   </span>
   ,
   <span class="command">
    <strong>
     SC STOP
    </strong>
   </span>
   , and
   <span class="command">
    <strong>
     SC DELETE
    </strong>
   </span>
   (or
   <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
    <span class="command">
     <strong>
      mysqld
     </strong>
    </span>
   </a>
   <a class="link" href="server-options.html#option_mysqld_remove">
    <code class="option">
     --remove
    </code>
   </a>
   ).
   <span class="command">
    <strong>
     NET
    </strong>
   </span>
   commands can also be used to start or stop a service. For
        additional information, see
   <a class="xref" href="windows-start-service.html" title="2.3.3.8 Starting MySQL as a Windows Service">
    Section 2.3.3.8, “Starting MySQL as a Windows Service”
   </a>
   .
  </p>
 </div>
 <br/>
</div>
