The complete packages are available on the apt repo and instructions for installing are
Installing MySQL NDB Cluster Using the APT Repository
NDB Cluster Installation.
Still, no service files for systemd are provided for management server and data nodes. The systemd model does not map nicely to MySQL Cluster.
Below follow an example of configuration and service files that should work for many cases, but not all.
One limitation is the clusters must have exactly one management server, and at most one data node per host.
If there are several management servers one will need to distinguish between restarting management server with or without
--reload. And one can not use
ExecReload in an easy way for the reload configuration cases since management server needs to be restarted also in that case.
Systemd Service Files Example
Note, using these systemd service files is not the recommended way to manage cluster since there are several short comings with them.
Example uses paths as they appear on Ubuntu 22.10 using the MySQL APT repo.
The example depends on these extra directories to be created
# mkdir /etc/mysql/cluster
# mkdir -m 700 /var/lib/mysql-cluster
# chown mysql:mysql /var/lib/mysql-cluster
And these configuration files to be added
/etc/mysql/cluster/config.ini (the sections also has alias names [MGM] same as [ndb_mgmd], [DB] same as [ndbd], [API] same as [mysqld]):
# Empty section to be able to run other ndb client programs from anywhere
Service file for management server
Description=MySQL Cluster Management Node
# Starting with --reload forces the config-file to be reread, but it works if
# there is only one managment server in the cluster.
# If there are more management servers one need to ensure that at most one
# management server at restarts with --reload.
ExecStart=/usr/sbin/ndb_mgmd --nodaemon --reload
Service file for data node
Description=MySQL Cluster Data Node
When bringing up the cluster, so called system (re)start, one first starts the management server
> systemctl start ndb_mgmd
and then all configured data nodes must be started, on each host with data nodes do:
> systemctl start ndbd
and then start all your MySQL servers:
> systemctl start mysql
After updating the cluster configuration file,
config.ini, one first need to restart the management server with
> systemctl restart ndb_mgmd
And then restart all data nodes and MySQL server such that they are aware of the new configuration. For data nodes one can use
ndb_mgm for restarts.
ndb_mgm> 2 RESTART
Node 2: Node shutdown initiated
Node 2: Node shutdown completed, restarting, no start.
Node 2 is being restarted
Node 2: Start initiated (version 8.0.33)
Node 2: Started (version 8.0.33)
ndb_mgm> 3 RESTART
ndb_mgm> 4 RESTART
For configuration changes that needs initial node restarts one need to use 'RESTART -i'.
Configuration changes that need initial system restart will be trickier. That can not be handled using
ndb_mgm but one need to stop all data nodes and then start them with an extra
--initial option to the start command.
Systemd do not have alternative start command, and the ndbd service does not and should not include
--initial in the
ExecStart command. Instead one need to manually remove all the data from disk
# rm -rf /var/lib/mysql-cluster/ndb_<number>_fs/
And then start service as usual
# systemctl start ndbd
ExecReload=kill -HUP does not work!
I searched internet for systemd service files for Ndb, and I found several all suggesting using
kill -HUP for
ExecReload to reload configuration - that does not work and have never worked,
HUP signal. Also for data nodes it is meaningless.
ndb_mgmd to reread
config.ini it needs to be restarted with
--reload command line option (except for the first time when there is no previous configuration read).
Comment on Comments on Question
The below is not really part of the answer but addresses some of the OP comments on question.
I want to add a third node to the cluster that will NOT have the data, as a tiebreaker.
If this about already having two data nodes in a nodegroup that have data, and then later add a third data node to the same nodegroup, that is not supported online by cluster.
All nodes in a nodegroup always must have the same data.
Changing the number of replicas requires so called initial system restart, start with an empty cluster and restore data from backup.
Adding nodes when adding a nodegroup can be done online, in this case the new nodegroup(s) will not have the same data as the original nodegroup(s), for this see Adding NDB Cluster Data Nodes Online
Which is highly frustrating as there is no node 3 in config.ini! It ONLY contains info for this one single host, and that ndbd config is node 2.
This sounds that the management server has not reread
config.ini, make sure that you restart management server using
ndb_mgmd ... --reload option after changing
Running on a different configuration than expected will bring much confusion.