Cluster: Use a set of servers to provide the same service lb : Load Balancer cluster ha : High-Reliability clustered MySQL Cluster server role? 1. Data node ndbd for storing data (table Records) 2, SQL node user access to data interface Execute SQL statements for user input 3, Management node mgmd manage all hosts in the cluster Load your own master profile when you start the management process, define the role of each host in the cluster 4, client: Access data as long as there are tools to connect to the database service // (mysql-cluster-client) mysql-clusert provides 3 kinds of process management processes management processes run on the management host NDBD processes runs on the data node. SQL process (the database service provided in the cluster software package, running on the SQL node)
One, install the software that provides the Cluster service pack
TAR-XVF Mysql-cluster-gpl-7.3.3-1.el6.x86_64.rpbundle.tar RPM-IVH mysql-cluster-*.rpm
Second, the Configuration management node 192.168.1.1
manage all hosts in the cluster, load your own master profile when you start the management process /etc/config.ini ( Sets the roles of the hosts in the cluster, the settings of the individual host roles at run-time parameters )
[ndbd default] // Data node public configuration [ndb_mgmd] //setting up the management host [ndbd] // Specify data node host [mysqld] // Specifying SQL Nodes mkdir /var/log/mysql-cluster //Create this directory yourself
 
vim /etc/config.ini //edit this file yourself [ndbd default] noofreplicas=2 //Data node host number datamemory=80m IndexMemory=18M [ndb_mgmd] //Management Node nodeid=1 hostname=192.168.1.1 datadir=/var/log/mysql-cluster [ndbd] //Data Node nodeid=2 hostname=192.168.1.10 datadir=/var/log/mysql-cluster/data [ndbd] // Data node nodeid=20 hostname=192.168.1.20 datadir=/var/log/mysql-cluster/data [mysqld] //mysql node nodeid=10 hostname=192.168.1.30 [mysqld] nodeid=30 hostname=192.168.1.40:wq
Third, configure the data node 192.168.1.10 192.168.1.20
data nodes are used to store data , run the data process
Ping 192.168.1.1mkdir-p/var/log/mysql-cluster/data//create this directory yourself VIM/ETC/MY.CNF Edit this file yourself [Mysqld]datadir=/var/log/mysql-cluster/data ndb-connectstring=192.168.1.1ndbcluster [mysql_cluster]ndb-connectstring=192.168.1.1 Another data node configuration just like this scp/etc/my.cnf
Iv. Configuration SQL node 192.168.1.30 192.168.1.40
for user access and the Execution SQL statement, run MySQL Data Services.
Vim/etc/my.cnf[mysqld]ndbcluster Default-storage-engine=ndbcluster [mysql_cluster]ndb-connectst RING=192.168.1.1:WQ Another MySQL node configuration just like this scp/etc/my.cnf [email protected]:/etc/my.cnf
V. Start the Cluster service
1 Start the Management node
Ndb_mgmd-f/etc/config.ininetstat-untlap | Grep:1186ps aux | grep ndb_mgmdpkill-9 NDB_MGMD//End process requires this password [[email protected] ~]# ndb_mgm--NDB Cluster--Man Agement Client--ndb_mgm> Showndb_mgm>exit
2 Start Data node
[[Email protected] ~] #ndbdpgrep ndbd pkill-9 ndbd//End process requires this password * NDB node process Unable to start, execute iptables-f service iptables save on the management node and data node and then execute NDBD3 on the data node to start the SQL node service MySQL restart
VI. Verifying the cluster
Solve a single point of failure when there is a data node down the machine does not affect the service when there is a mysqldown machine also does not affect the service start MySQL often lack of xxx.pid this problem, just need to put/var/lib/mysql/down on the log file deleted on the line, and then re- Start the service
Deploy MySQL Cluster