2.5.1. Starting and Stopping the Agent on Linux

To start the MySQL Cluster Manager agent on a given host running a Linux or similar operating system, you should run mcmd, found in the bin directory within the manager installation directory on that host. The complete syntax for mcmd is shown here:

mcmd [--defaults-file | --bootstrap] [--log-file] [--log-level]

mcmd normally runs in the foreground. If you wish, you can use your platform's usual mechanism for backgrounding a process. On a Linux system, you can do this by appending an ampersand character (&), like this (not including any options that might be required):

shell> ./bin/mcmd &

By default, the agent assumes that the agent configuration file is etc/mcmd.ini, in the MySQL Cluster Manager installation directory. You can tell the agent to use a different configuration file by passing the path to this file to the --defaults-file option, as shown here:

shell> ./bin/mcmd --defaults-file=/home/mcm/mcm-agent.conf

The --bootstrap option causes the agent to start with default configuration values, create a default one-machine cluster named mycluster, and start it. This option works only if no cluster has yet created, and is mutually exclusive with the --defaults-file option. Currently, any data stored in the default cluster mycluster is not preserved between cluster restarts; this is a known issue which we may address in a future release of MySQL Cluster Manager.

The use of the --bootstrap option with mcmd is shown here on a system having the host name torsk, where MySQL Cluster Manager has been installed to /home/jon/mcm:

shell> ./mcmd --bootstrap
MySQL Cluster Manager 1.1.6 started
Connect to MySQL Cluster Manager by running "/home/jon/mcm/bin/mcm" -a torsk:1862
Configuring default cluster 'mycluster'...
Starting default cluster 'mycluster'...
Cluster 'mycluster' started successfully
        ndb_mgmd        torsk:1186
        ndbd            torsk
        ndbd            torsk
        mysqld          torsk:3306
        mysqld          torsk:3307
        ndbapi          *
Connect to the database by running "/home/jon/mcm/cluster/bin/mysql" -h torsk -P 3306 -u root

You can then connect to the agent using the mcm client (see Section 2.6, “Starting the MySQL Cluster Manager Client”), and to either of the MySQL Servers running on ports 3306 and 3307 using mysql or another MySQL client application.

The --log-file option allows you to override the default location for the agent log file (normally mcmd.log, in the MySQL Cluster Manager installation directory).

You can use --log-level option to override the log-level set in the agent configuration file. See Section 2.4, “MySQL Cluster Manager Configuration File”, for information about possible values and their effects on logging.

The MySQL Cluster Manager agent must be started on each host in the MySQL Cluster to be managed.

To stop one or more instances of the MySQL Cluster Manager agent, use the stop agents command in the MySQL Cluster Manager client (see Section 3.7, “The stop agents Command”, for more information and examples). If the client is unavailable, you can stop each agent process using the system's standard method for doing so, such as ^C or kill.

In addition, the agent does not automatically run as a daemon or service on Linux and other Unix-like systems; if an agent process fails, you must either have your own mechanism in place for detecting the failure and restarting the agent process or restart it manually. (This is not true for MySQL Cluster Manager on Windows; see Section 2.5.3, “Installing the MySQL Cluster Manager Agent as a Windows Service”, for more information.)