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 and my.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:
 

  1. Create the directories /data/mysqlcluster

    $ mkdir -p /data/mysqlcluster

    Note

    This is the directory stated as datadir in the config.ini file. If another directory is stated in the config.ini file, this directory has to be created instead.

     

  2. 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.

     

  3. 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.

     

  4. Add a user called mysql and give the user a password:

    $ adduser mysql

     

  5. Run the installation script from the software folder for MySQL Server, i e the folder stated as basedir in the my.cnf file:

    $ ./scripts/mysql_install_db --defaults-file=/etc/my.cnf

     

  6. Change the owner of the folder specified as datadir in the my.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>

     

  7. 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.

Â