Skip to content

Stopping programs#

This chapter details how to stop the servers that are constantly running in RonDB. These programs are ndb_mgmd, ndbmtd and mysqld.

Stopping ndb_mgmd#

The simplest manner to stop ndb_mgmd is to simply kill it using a normal kill program (kill or killall in Linux).

kill -TERM PIDOF(ndb_mgmd)

Replace PIDOF(ndb_mgmd) by the PID of the ndb_mgmd process.

An alternative is to stop it using the management client. In this case you use the command:

ndb_mgm> 65 STOP

where 65 here would be the node id of the ndb_mgmd process, change it to the node id of the management server you want to stop.

One advantage of using the STOP command is that ndb_mgmd will inform the cluster nodes that it is going down before actually shutting down. This means that the cluster can select a new arbitrator before the management server is shut down.

Stopping ndbmtd#

The simplest manner to stop ndbmtd is to simply kill it using a normal kill program (kill or killall in Linux).

kill -TERM PIDOF(ndbmtd)

Replace PIDOF(ndbmtd) by the process id of the ndbmtd process. RonDB introduced a new feature in RonDB 21.04.1 that ensures that the kill -TERM command will use a graceful shutdown of the data node. This makes it very easy to use OS services to start and stop ndbmtd programs.

An alternative is to stop it using the management client. In this case you use the command:

ndb_mgm> 1 STOP

where 1 here would be the node id of the ndbmtd process, change it to the node id of the RonDB data node you want to stop. This is also a graceful shutdown.

When we start a RonDB data node we can configure it to automatically restart. In this case there are two ndbmtd processes. The STOP command will stop both of them. The STOP command will not perform the stop if it will cause a cluster failure. This is an extra level of checking in the STOP command.

If RonDB is configured with RestartOnError then to stop the ndbmtd such that it doesn’t automatically start again requires kill of both of the ndbmtd processes.

In Hopsworks we manage the cluster using agent processes on all VMs in the cluster. We use simple systemctl commands to start and stop processes that invokes scripts that use the simple methods of stopping use the kill commands. These agent processes keep track of the cluster state to ensure that no cluster failures occur due to shutting down nodes.

Stopping mysqld#

Also for the MySQL Server the simplest approach is to stop the MySQL Server using the kill command.

kill -TERM PIDOF(mysqld)

Replace PIDOF(mysqld) with the process id of the MySQL server. This performs a graceful shutdown.

Another method is to use the mysqladmin program to shut down the server. This programs connects to the MySQL Server using the same manner as a MySQL client.

mysqladmin shutdown

In addition one would need a set of parameters to specify host, port, user, password and any other parameters needed to connect to the MySQL Server. This also performs a graceful shutdown of the MySQL server.

Hard stop#

All the above cases shows how to do graceful shutdowns. A graceful shutdown will ensure that the node isn’t performing any queries that will be aborted by the shutdown. It gives the nodes a bit of time to complete the ongoing requests.

In some cases the process can get completely stuck and require a hard stop. The handling of this is the same for all process types. We use the kill -9 command.

kill -9 PID

Replace PID by the process id of the process you are performing the hard stop of.

This shuts down the process immediately and cause ongoing transactions to be aborted. But it won’t cause any inconsistencies in the database.