You must verify that each process in the “wild” cluster has a valid PID file. For purposes of this discussion, a valid PID file has the following characteristics:
The filename is
node_idis the node ID used for this process.
The file is located in the data directory used by this process.
The first line of the file contains the process ID, and only the process ID.
To check the PID file for the management node process, log into the system shell on host
alpha, and change to the management node's data directory. If this is not specified, the PID file should be created in the same directory that ndb_mgmd runs in; change to this directory instead. Then check to see whether the PID file is present using your system's tools for doing this. On Linux, you can use the command shown here:
shell> ls ndb_1* ndb_1_cluster.log ndb_1_out.log ndb_1.pid
Check the content of the matching
.pidfile using a pager or text editor. We use more for this purpose here:
shell> more ndb_1.pid 17066
The number shown should match the ndb_mgmd process ID. We can check this on Linux as before, using ps:
shell> ps -ef | grep ndb_mgmd jon 17066 1 1 19:16 ? 00:00:01 ./ndb_mgmd -f /etc/mysql-cluster/config.ini --config-cache=false jon 17942 1819 0 19:17 pts/2 00:00:00 grep --color=auto ndb_mgmd
The management node PID file satisfies the requirements listed at the beginning of this section. Next, we check the PID files for the data nodes, on hosts
gamma. Log into a system shell on
beta, then obtain the process ID of the ndbd process on this host, as shown here:
shell> ps -ef | grep ndbd jon 2024 1 1 18:46 ? 00:00:01 ./ndbd -c alpha jon 2150 1819 0 18:47 pts/2 00:00:00 grep --color=auto ndbd
We observed earlier (see Section 126.96.36.199, “Creating and Configuring the Target Cluster”) that this node's node ID is 5 and that its
/var/lib/mysql-cluster. Check in this directory for the presence of a file named
shell> ls /var/lib/mysql-cluster/ndb_5.pid ndb_5.pid
Now check the content of this file and make certain that it contains the process ID 2024 on the first line and no other content, like this:
shell> more /var/lib/mysql-cluster/ndb_5.pid 2024
Similarly, we locate and check the content of the PID file for the remaining data node (node ID 6, data directory
/var/lib/mysql-cluster/) on host
shell> ps -ef | grep ndbd jon 2067 1 1 18:46 ? 00:00:01 ./ndbd -c alpha jon 2150 1819 0 18:47 pts/2 00:00:00 grep --color=auto ndbd shell> ls /var/lib/mysql-cluster/ndb_6.pid ndb_6.pid shell> more /var/lib/mysql-cluster/ndb_6.pid 2067
The PID file for this data node also meets our requirements, so we are now ready to proceed to the mysqld binary running on host
delta. We handle the PID file for this process in the next step.
If a given process does not have a valid PID file, you must create one for it, or, in some cases, modify the existing one. This is most likely to be a concern when checking PID files for mysqld processes, due to the fact that the MySQL Server is customarily started using the startup script mysqld_safe, which can start the mysqld binary with any number of default options, including the
--pid-fileoption. We see that is the case when we check on host
deltafor the running mysqld process there (emphasized text):
shell> ps -ef | grep mysqld jon 8782 8520 0 10:30 pts/3 00:00:00 /bin/sh ./mysqld_safe --ndbcluster --ndb-connectstring=alpha jon 8893 8782 1 10:30 pts/3 00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --ndbcluster --ndb-connectstring=alpha --log-error=/usr/local/mysql/data/delta.err --pid-file=/usr/local/mysql/data/delta.pid jon 8947 8520 0 10:30 pts/3 00:00:00 grep --color=auto mysqld shell> more /usr/local/mysql/data/delta.pid 8893
The PID for the SQL node is in an acceptable location (the data directory) and has the correct content, but has the wrong name.
You can create a correct PID file in either of two locations—in the process data directory, or in the directory
on the same host as the process, where
mcm_diris the MySQL Cluster Manager installation directory, and
cluster_nameis the name of the cluster. In this case, since the existing PID file is otherwise correct, it is probably easiest just to copy it to a correctly named file in the same directory incorporating the node ID (100), like this:
shell> cp /usr/local/mysql/data/delta.pid /usr/local/mysql/data/ndb_100.pid
Another alternative is to create and write a completely new PID file to the proper location in the MySQL Cluster Manager installation directory, as shown here:
shell> echo '8893' > /opt/mcm-1.3.6/clusters/newcluster/pid/ndb_100.pid shell> more /opt/mcm-1.3.6/clusters/newcluster/pid/ndb_100.pid 8893
ndbapiprocesses running under MySQL Cluster Manager do not require PID files, so we have completed this step of the import, and we should be ready for a test or “dry run” of the migration. We perform this test in the next step.