Install MySQL NDB
Download: mysql-cluster-gpl-7.1.10-linux-x86_64-glibc23.tar.gz
Before configuring the ndb, You need to systematically grasp the mysql ndb configuration method theoretically, so that you can avoid many detours.
I. Pre-configuration Planning
Management node IP: 192.168.133.98 node ID: id = 1
NDB data node 1: 192.168.133.101 node ID: id = 2
NDB data node 2: 192.168.133.102 node ID: id = 3
Mysql Node 1: 192.168.133.62 node ID: id = 4
Mysql Node 2: 192.168.133.100 node ID: id = 5
OS: CentOS 5.4 64-bit, 4 GB memory, 5 machines are all virtual machines, all running on Vmware vsphere.
[Root @ localhost ndbdatabase] # uname-
[Root @ localhost ndbdatabase] #: Linux localhost. localdomain 2.6.18-164. el5 #1 SMP Thu Sep 3 03:28:30 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
--------------------------------------------------------------------------------
Ii. Start Installation
A. Install the data node and mysql node. The following operations are repeated four times and executed on nodes other than the management node:
# Groupadd mysql
# Useradd-g mysql
# Tar zxvf mysql-cluster-gpl-7.1.10-linux-x86_64-glibc23.tar.gz
# Chown mysql: mysql mysql-cluster-gpl-7.1.10-linux-x86_64-glibc23
# Cd mysql-cluster-gpl-7.1.10-linux-x86_64-glibc23
# Mv */usr/local/mysql
The preceding command first creates a mysql group and a mysql user, assigns MySQL to the MySQL group, decompress the installation file, and places it in the/usr/local/mysql directory.
---------------------------------------------------------------------------------
Iii. Configuration
Configuration Management node [192.168.133.98]:
Create the following file/var/lib/mysql-cluster/config. ini and add the following content to it:
[Ndbd default]
NoOfReplicas = 2 #2 indicates the node
DataMemory = 100 M
IndexMemory = 100 M
[Tcp default]
Portnumber = 2202
# Manage nodes
[NDB_MGMD]
Id = 1
Hostname = 192.168.133.98
Datadir =/var/lib/mysql-cluster
# First ndbd Node
[NDBD]
Id = 2
Hostname = 192.168.133.101
Datadir =/usr/local/mysql/ndbdata
# Second ndbd Node
[NDBD]
Id = 3
Hostname = 192.168.133.102
Datadir =/usr/local/mysql/ndbdata
# SQL node
[Mysqld]
Id = 4
Hostname = 192.168.133.62
[Mysqld]
Id = 5
Hostname = 192.168.133.100
In this file, IDs are assigned to the four nodes, which facilitates better management and differentiation of each node. Of course, if not specified, MySQL will also dynamically allocate one. The preceding Datadir files must be manually created if they do not exist. Run the mkdir-p command.