3.5.2.4 Testing and Migrating the Standalone Cluster

Testing and performing and performing the migration of a standalone MySQL Cluster into MySQL Cluster Manager consists of the following steps:

  1. Perform a test run of the proposed import using import cluster with the --dryrun option. When this option is used, MySQL Cluster Manager checks for mismatched configuration attributes, missing or invalid processes or hosts, missing or invalid PID files, and other errors, and warns of any it finds, but does not actually perform any migration of processes or data.

    mcm> import cluster --dryrun newcluster;
    ERROR 5302 (00MGR): No access for user mcmd to mysqld 100 in cluster newcluster.
    Please verify user access and grants adhere to documented requirements.

    We omitted a crucial step earlier: we apparently neglected to create the mcmd superuser account needed on all SQL nodes in the wild cluster to bring them under control of MySQL Cluster Manager. In this case, there is only one SQL node, running on delta. Log into this SQL node as the MySQL root user, and create the mcmd account in the mysql client, as shown here:

    $> ./mysql -uroot -p
    Enter password: ************
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 3
    Server version: 5.6.24-ndb-7.4.6 Source distribution
    
    Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    mysql> CREATE USER 'mcmd'@'localhost' IDENTIFIED BY 'super';
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> GRANT ALL PRIVILEGES ON *.*
        ->     TO 'mcmd'@'localhost' IDENTIFIED BY 'super'
        ->     WITH GRANT OPTION;
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> SHOW GRANTS FOR 'mcmd'@'localhost'\G
    *************************** 1. row ***************************
    Grants for mcmd@localhost: GRANT ALL PRIVILEGES ON *.* TO 'mcmd'@'localhost'
    IDENTIFIED BY PASSWORD '*F85A86E6F55A370C1A115F696A9AD71A7869DB81' WITH GRANT OPTION
    1 row in set (0.00 sec)

    Having corrected this issue on the SQL node, we repeat the dry run in the mcm client:

    mcm> import cluster --dryrun newcluster;
    ERROR 5310 (00MGR): Process ndb_mgmd 50 reported 6 processes, while 5 processes
    are configured for cluster newcluster

    This error means that there are one or more cluster processes not accounted for the configuration for the target cluster. Checking the contents of the file /etc/mysql-cluster/config.ini on host alpha, we see that we overlooked a section in it earlier. This section is shown here:

    [mysqld]
    NodeId=102

    To address this discrepancy, we need to add another free ndbapi process to newcluster, which we can do by executing the following add process command in the mcm client:

    mcm> add process -R ndbapi:102@* newcluster;
    +----------------------------+
    | Command result             |
    +----------------------------+
    | Process added successfully |
    +----------------------------+
    1 row in set (0.38 sec)

    You can verify this by checking the output of show status -r command, as shown here:

    mcm> show status -r newcluster;
    +--------+----------+-------+--------+-----------+------------+
    | NodeId | Process  | Host  | Status | Nodegroup | Package    |
    +--------+----------+-------+--------+-----------+------------+
    | 50     | ndb_mgmd | alpha | import |           | newpackage |
    | 5      | ndbd     | beta  | import | n/a       | newpackage |
    | 6      | ndbd     | gamma | import | n/a       | newpackage |
    | 100    | mysqld   | delta | import |           | newpackage |
    | 101    | ndbapi   | *     | import |           |            |
    | 102    | ndbapi   | *     | import |           |            |
    +--------+----------+-------+--------+-----------+------------+
    6 rows in set (0.11 sec)

    Now we can run another test, using import cluster with the --dryrun as we did previously:

    mcm> import cluster --dryrun newcluster;
  2. Continue to correct any errors or other discrepancies found using --dryrun, repeating the dry run shown in the previous step to ensure that no errors were missed. The following list contains some common errors you may encounter, and their likely causes:

    • MySQL Cluster Manager requires a specific MySQL user and privileges to manage SQL nodes. If the mcmd MySQL user account is not set up properly, you may see No access for user..., Incorrect grants for user..., or possibly other errors. See Section 3.5.2.2, “Preparing the Standalone Cluster for Migration”.

    • As described previously, each cluster process (other than a process whose type is ndbapi) being brought under MySQL Cluster Manager control must have a valid PID file. Missing, misnamed, or invalid PID files can produce errors such as PID file does not exist for process..., PID ... is not running ..., and PID ... is type .... See Section 3.5.2.3, “Verify All Cluster Process PID Files”.

    • Process version mismatches can also produce seemingly random errors whose cause can sometime prove difficult to track down. Ensure that all nodes are supplied with the correct release of the MySQL Cluster software, and that it is the same release and version of the software.

    • Each data node angel process in the standalone cluster must be stopped prior to import. A running angel process can cause errors such as Angel process pid exists ... or Process pid is an angel process for .... See Section 3.5.2.2, “Preparing the Standalone Cluster for Migration”.

    • The number of processes, their types, and the hosts where they reside in the standalone cluster must be reflected accurately when creating the target site, package, and cluster for import. Otherwise, errors such as Process id reported # processes ..., Process id ... does not match configured process ..., Process idnot configured ..., and Process iddoes not match configured process .... See Section 3.5.2.1, “Creating and Configuring the Target Cluster”.

    • Other factors that can cause specific errors include processes in the wrong state, processes that were started with unsupported command-line options (see Section 3.5.2.1, “Creating and Configuring the Target Cluster” for details) or without required options, and processes having the wrong process ID, or using the wrong node ID.

  3. When import cluster --dryrun no longer warns of any errors, you can perform the import with the import cluster command, this time omitting the --dryrun option.