Spec-Zone .ru
спецификации, руководства, описания, API

17.2.3.4. Installing MySQL Cluster Processes as Windows Services

Once you are satisfied that MySQL 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 NET START or NET STOP command, or using the Windows graphical Services utility.

Installing programs as Windows services usually must be done using an account that has Administrator rights on the system.

To install the management node as a service on Windows, invoke ndb_mgmd.exe from the command line on the machine hosting the management node, using the --install option, as shown here:

C:\> C:\mysql\bin\ndb_mgmd.exe
        --installInstalling service 'MySQL Cluster Management Server'   as '"C:\mysql\bin\ndbd.exe" "--service=ndb_mgmd"'Service successfully installed.
Important

When installing a MySQL Cluster program as a Windows service, you should always specify the complete path; otherwise the service installation may fail with the error The system cannot find the file specified.

The --install option must be used first, ahead of any other options that might be specified for ndb_mgmd.exe. 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 ndb_mgmd.exe --help, you can specify the location using the --config-file option.

Now you should be able to start and stop the management server like this:

C:\> NET START ndb_mgmdThe MySQL Cluster Management Server service is starting.The MySQL Cluster Management Server service was started successfully.C:\> NET STOP ndb_mgmdThe MySQL Cluster Management Server service is stopping..The MySQL Cluster Management Server service was stopped successfully.

You can also start or stop the management server as a Windows service using the descriptive name, as shown here:

C:\> NET START 'MySQL Cluster Management
        Server'The MySQL Cluster Management Server service is starting.The MySQL Cluster Management Server service was started successfully.C:\> NET STOP 'MySQL Cluster Management Server'The MySQL Cluster Management Server service is stopping..The MySQL Cluster Management Server service was stopped successfully.

However, 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 ndb_mgmd, append it to the --install option, as shown in this example:

C:\> C:\mysql\bin\ndb_mgmd.exe --install=mgmd1Installing service 'MySQL Cluster Management Server'   as '"C:\mysql\bin\ndb_mgmd.exe" "--service=mgmd1"'Service successfully installed.

Now you should be able to start or stop the service using the name you have specified, like this:

C:\> NET START mgmd1The MySQL Cluster Management Server service is starting.The MySQL Cluster Management Server service was started successfully.C:\> NET STOP mgmd1The MySQL Cluster Management Server service is stopping..The MySQL Cluster Management Server service was stopped successfully.

To remove the management node service, invoke ndb_mgmd.exe with the --remove option, as shown here:

C:\> C:\mysql\bin\ndb_mgmd.exe
        --removeRemoving service 'MySQL Cluster Management Server'Service successfully removed.

If you installed the service using a service name other than the default, you can remove the service by passing this name as the value of the --remove option, like this:

C:\> C:\mysql\bin\ndb_mgmd.exe --remove=mgmd1Removing service 'mgmd1'Service successfully removed.

Installation of a MySQL Cluster data node process as a Windows service can be done in a similar fashion, using the --install option for ndbd.exe (or ndbmtd.exe), as shown here:

C:\> C:\mysql\bin\ndbd.exe --installInstalling service 'MySQL Cluster Data Node Daemon' as '"C:\mysql\bin\ndbd.exe" "--service=ndbd"'Service successfully installed.

Now you can start or stop the data node using either the default service name or the descriptive name with net start or net stop, as shown in the following example:

C:\> NET START ndbdThe MySQL Cluster Data Node Daemon service is starting.The MySQL Cluster Data Node Daemon service was started successfully.C:\> NET STOP ndbdThe MySQL Cluster Data Node Daemon service is stopping..The MySQL Cluster Data Node Daemon service was stopped successfully.C:\> NET START 'MySQL Cluster Data Node Daemon'The MySQL Cluster Data Node Daemon service is starting.The MySQL Cluster Data Node Daemon service was started successfully.C:\> NET STOP 'MySQL Cluster Data Node Daemon'The MySQL Cluster Data Node Daemon service is stopping..The MySQL Cluster Data Node Daemon service was stopped successfully.

To remove the data node service, invoke ndbd.exe with the --remove option, as shown here:

C:\> C:\mysql\bin\ndbd.exe --removeRemoving service 'MySQL Cluster Data Node Daemon'Service successfully removed.

As with ndb_mgmd.exe (and mysqld.exe), when installing ndbd.exe as a Windows service, you can also specify a name for the service as the value of --install, and then use it when starting or stopping the service, like this:

C:\> C:\mysql\bin\ndbd.exe
        --install=dnode1Installing service 'dnode1' as '"C:\mysql\bin\ndbd.exe" "--service=dnode1"'Service successfully installed.C:\> NET START dnode1The MySQL Cluster Data Node Daemon service is starting.The MySQL Cluster Data Node Daemon service was started successfully.C:\> NET STOP dnode1The MySQL Cluster Data Node Daemon service is stopping..The MySQL Cluster Data Node Daemon service was stopped successfully.

If you specified a service name when installing the data node service, you can use this name when removing it as well, by passing it as the value of the --remove option, as shown here:

C:\> C:\mysql\bin\ndbd.exe
        --remove=dnode1Removing service 'dnode1'Service successfully removed.

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 mysqld --install, NET START, NET STOP, and mysqld --remove. For additional information, see Section 2.3.5.7, "Starting MySQL as a Windows Service".