5.2.3. Initial Startup of the MySQL Cluster
When you have created the config.ini
and my.cnf
files you have to make an initial startup of the cluster. In order to do this you have to be logged in as root
.
Note!
- All the instructions in this section are based on the assumption that the
config.ini
andmy.cnf
files are located in the/etc/
folder. - If the files have been placed in a different folder, the paths in the commands beneath has to be adjusted accordingly.
- If the
/mysql/bin
directory has not been added to your path, you have to use the--basedir
option to point out this directory.
To make an initial startup of the MySQL Cluster:
Create the directories
/data/mysqlcluster
$ mkdir -p /data/mysqlcluster
Note
This is the directory stated as
datadir
in theconfig.ini
file. If another directory is stated in theconfig.ini
file, this directory has to be created instead.In the
/mysql/bin
directory start up the management node with the following command:$ ./ndb_mgmd -f /etc/config.ini --configdir=/etc/ --initial
The
--initial
flag should only be used for the initial startup.Start each of the data nodes on their respective servers with the following command:
$ ./ndbmtd --ndb-connectstring=<host IP address>:<host port> --ndb-nodeid=<node id of the data node> --initial
The
--initial
flag is usually only used for the initial start. If it is included when starting an existing database, the content of the database will be erased. However, if specific configurations are updated, this flag will be needed, but in that case, a rolling restart will be required. For further information, see Updating MySQL Cluster Configurations Without Downtime in 4.2 MySQL Cluster Configuration in the PCC System Administration Guide.Add a user called mysql and give the user a password:
$ adduser mysql
Run the installation script from the software folder for MySQL Server, i e the folder stated as
basedir
in themy.cnf
file:$ ./scripts/mysql_install_db --defaults-file=/etc/my.cnf
Change the owner of the folder specified as
datadir
in themy.cnf
file to be mysql.It it is important that the script in the previous step has finished before you perform this step.
$ chown -R mysql:mysql <directory>
In the
/usr/mysql/bin/
directory, start the MySQL Server with the following command:$ ./mysqld --defaults-file=/etc/my.cnf
When the ndb tables are writeable, you can proceed with creating the tables.