Never give up, everything is possible!!!
Only to find a way to succeed, not to find excuses for failure!
MySQL cluster installation (CentOS) MySQL cluster:   
1. Distributed database system based on NDB Cluster
2. Each server node in the MySQL cluster does not share data
3. In MySQL cluster node refers to the process, which is different from the other nodes in the cluster refers to the situation of the computer, so there can be any number of nodes on a single computer
4. Three nodes: 1) Management node: Management of other nodes in cluster; Including start, stop, Backup, configuration, etc.;
The management node needs to be started before other nodes can be started
The management node should not be one, otherwise if the outage causes the cluster to be unavailable
2) Data node: Save cluster data,
If there are two replicas, each copy has two fragments, then there are 4 data nodes, and so on
3) SQL node: for accessing data in cluster
In the lowest MySQL cluster configuration, there should be at least three nodes
5. Starting mode:
Management node: NDB_MGMD data node: Ndbdsql node: Mysqld_ndbcluster  , after changing the MY.CNF profile, mysqld boot is available, as described below
6. Default port:
11862202
Get ready:   
1. mysql Download link: http://mysql.mirror.kangaroot.net/Downloads/MySQL-Cluster-7.3/
Connect to Linux using the Pietty tool
and WINSCP tools for file copy
2.3 Servers: CentOS 6.4, network connection: bridged
192.168.1.136: Managing Nodes
192.168.1.95: Data node
192.168.1.62:sql node
3. Installation Location:/usr/local/mysql
Data location:/usr/local/mysql/data
Log location:/usr/local/mysql/log
4. Relevant CentOS instructions:
View CentOS Version: cat/etc/redhat-Release to see if MYSQL:RPM-QA is installed |grep MySQL View services Status: Service MySQL staus shutdown current SQL service:/etc/init.d/Mysqld stop starts the current SQL service:/etc/init.d/mysqld Start restart SQL service:/etc/init.d/Mysqld Restart to see if the process is closed: Ps-ef |grep mysql Uninstall installed mysql:rpm-e--allmatches--nodeps MySQL mysql-Server Delete Related directory: rm-rf/usr/local/MySQL RM-RF/var/MySQL RM-RF/var/lib/MySQL group and user add: Groupadd mysql useradd mysql-G MySQL Decompression: tar-zxvf mysql-cluster-gpl-7.3.4-LINUX-GLIBC2.5-i686.tar.gz renaming folders: MV mysql-cluster-gpl-7.3.4-LINUX-GLIBC2.5-i686 mysql change file or folder owner: Chown mysql:mysql MySQL (in front of the user in Mysql:mysql, followed by a group) script: scripts/ mysql_install_db--user=mysql (--user=mysql indicates user identity for MySQL group) Create folder: mkdir/var/lib/mysql-cluster (plus-var/lib/mysql-cluster/config.ini VI filename: Opening or creating a new file and place the cursor at the beginning of the first line VI +n filename: Open the file and place the cursor at the beginning of the Nth line VI + filename : Open the file and place the cursor at the end of the line VI +/pattern filename: Open the file and place the cursor at the first string that matches the pattern VI-r FileName: The last time I was using VI to edit a system crash, restore filename VI filename....filename: Open multiple files, and then edit the permanently shut down the firewall: chkconfig--level 35    
Installation:   
1. Check whether the installation has been installed before installation, such as installed uninstall reinstall
See if MYSQL:RPM-QA is installed | grep MySQL View services Status: Service MySQL staus shutdown current SQL service:/etc/init.d/mysqld stop start current SQL service:/etc/init.d/mysqld Start restart SQL Service:     /etc/init.d/mysqld Restart to see if the process is closed: ps-ef | grep mysql Uninstall installed mysql:rpm-e--allmatches-- nodeps mysql mysql-server Delete Related directory: rm-rf/usr/local/mysql rm-rf/var/mysql rm-rf/var/lib/mysql
              
   
2. Managing node Installation
Installing on the 192.168.1.136
[[email protected] ~]# groupadd MySQL////   Add user [[email protected] ~]# cd/usr/local[[email protected ] local]# tar-zxvf mysql-cluster-gpl-7.3.  4-LINUX-GLIBC2. // unzip [[email protected] local]# mv mysql-cluster-gpl-7.3.  4-LINUX-GLIBC2. // rename           
Change Folder owner // installation  
   
3. Managing node Configuration
[[Email protected] mysql]# CD ~[[email protected] ~]# mkdir/var/lib/mysql-cluster[[email protected] ~]# Mkdi R  /usr/local/mysql/log[[email protected] ~]# CD/var/lib/mysql-cluster[[email protected] mysql-cluster]# VI +/var/lib/mysql-cluster/config.ini[[email protected] mysql-cluster]# VI +/var/lib/ Mysql-cluster/config.ini         
The contents of the Config.ini file are as follows:
[NDBD DEFAULT] noofreplicas=1[NDB_MGMD] #设置管理节点服务器 hostname=192.168.  1.136datadir=/usr/local/mysql/data[ndbd] #设置存储节点服务器 (NDB node) hostname=192.168.  1.95datadir=/usr/local/mysql/[MYSQLD] #设置SQL节点服务器 hostname=192.168.  1.62
   
To start the management node:
/usr/local/mysql/bin/ndb_mgmd-f/Var/lib/mysql-cluster/config.ini  //-F indicates that the following parameter is the startup configuration parameter file 
We see that port 1186 of the Management node has been monitored:
To close the management node:
[Email protected] ~]#/USR/LOCAL/MYSQL/BIN/NDB_MGM-e shutdown
Connected to Management Server at:localhost:11861 NDB Cluster node (s) has shutdown. Disconnecting to allow Management Server to shutdown.  
   
4. Data node and SQL node installation
1) 192.168.1.95: Data node, new user and Group on 192.168.1.62:sql node in the same way as above
Groupadd mysqluseradd mysql-g MySQL
2) Copy the Management node/usr/local/mysql directory to the Data node and node
   
5. SQL Node Configuration:
[[email protected] mysql]# CP support-files/my-default.cnf/etc/my.cnf[[email protected] mysql]# CP support-files/ Mysql.server/etc/init.d/mysqld
Cd/etcVI my.cnf Add the following: [mysqld]ndbclusterndb-connectstring=192.168.  1.136ndb-connectstring=192.168.  1.136[ndb_mgm]connect-string=192.168.  1.136         
SQL node start: Service mysqld start (need to start management node)
[[Email protected] mysql]# service mysqld startstarting MySQL ......................................................................................................................... .... success!
SQL node shutdown:/usr/local/mysql/bin/mysqladmin-uroot shutdown
   
6. Data node Configuration
[[email protected] mysql]# CP support-files/my-default.cnf/etc/my.cnf[[email protected] mysql]# CP support-files/ Mysql.server/etc/init.d/mysqld
cd/etc/VI my.cnf added: [mysqld]ndbclusterndb-connectstring=192.168.  1.136[mysql_cluster]ndb-connectstring=192.168.  1.136[ndb_mgm]connect-string=192.168.  1.136         
Data node Start:
/USR/LOCAL/MYSQL/BIN/NDBD--initial (need to start the management node)
[Email protected] support-files]#/USR/LOCAL/MYSQL/BIN/NDBD--initial2014-06-:'  192.168.1.136:1186'2014-06-:2        
Test:   
To create a database on a data node
[Email protected] mysql]#/etc/rc.d/init.d/mysqld status [[email protected] localhost ~]#/etc/rc.d/init.d/  mysqld start [[email protected] localhost ~]#/usr/local/mysql/bin/mysql–u root-p mysql> show database; MySQL  > CREATE Database wishtestdb; mysql> use wishtestdb; mysql> CREATE TABLE table1_test (ID varchar (50), Name varchar (mysql>  );        
To view the data on the SQL node:
Mysql> fromtable1_test;
MySQL cluster installation (CentOS)