This section describes how to install, configure mysql-data1.mytest.com, and mysql-data2.mytest.com In Ubuntu.
Install MySQL
Install the MySQL server on both the mysql-data1 and the mysql-data2:
$ Sudo apt-get update install mysql-server
During installation, the installer requires you to set the MySQL root Password. Set and remember the password.
After the program is installed, stop the MySQL service:
$ Sudo/etc/init. d/mysql stop
Configure my. cnf
On both the mysql-data1 and mysql-data2 servers, perform the same action.
First, back up the original/etc/mysql/my. cnf:
$ Sudo mv/etc/mysql/my. cnf/etc/mysql/my. cnf-back
Then, edit a new my. cnf:
$ Sudo nano/etc/mysql/my. cnf
The content is as follows:
[Client]
Socket =/var/run/mysqld. sock
Port = 3306
[Mysqld]
Ndbcluster
Ndb-connectstring = 192.168.1.10 # IP address of the Management Node
Default-storage-engine = NDBCLUSTER
[Mysql_cluster]
Ndb-connectstring = 192.168.1.10 # IP address of the Management Node
After the file is saved, you can start the ndb service:
$ Sudo/etc/init. d/mysql-ndb start-initial
When you are prompted to start the ndb service, use/etc/init. d/mysql-ndb start. In the following cases, use/etc/init. d/mysql-ndb start-initial ("initialization" to start ):
Enable the ndb service for the first time;
After the configuration of the Management node is changed.
If you encounter the following errors when starting the ndb service:
* Starting MySQL NDB Data Node ndbd error = 2350
22:20:55 [ndbd] INFO -- Error handler restarting system
22:20:55 [ndbd] INFO -- Error handler shutdown completed-exiting
Sphase = 0
Exit =-1
The ndb service has been started. Run the following command to check whether the ndb service has been started:
$ Ps aux | grep ndb | grep-v grep
Now you can start the mysql service:
$ Sudo/etc/init. d/mysql start