1. Install the mysql-cluster package on all database servers first
Management machine: 192.168.1.6
Data node: 192.168.1.31 192.168.1.32
SQL node: 192.168.1.33 192.168.1.111
2. Configure on the Management node
[Email protected] ~]# Vim/etc/config.ini
[NDBD Default]//Data node public configuration noofreplicas=2//Data Backup number datamemory=300m//query cache indexmemory=100m//index cache [NDB_MGMD]//Manage node parameters Number nodeid=1//hostname=192.168.1.6//Management machine Ipdatadir=/mysqlcluster/log//Native cluster log directory (manually created beforehand) [NDBD]//A data node Parameter nodeid=10//hostname=192.168.1.31//This data node Ipdatadir=/mysqldata//Data storage directory (manually created on that stage) [ndbd]nodeid=20hostname=192. 168.1.32DATADIR=/MYSQLDATA[MYSQLD]//One SQL node parameter nodeid=30 hostname=192.168.1.33//sql node ip[mysqld]nodeid=40hostname= 192.168.1.111
3. Configuration on the Data node
[Email protected] ~]# VIM/ETC/MY.CNF
[Mysqld]datadir=/mysqldata ndb-connectstring=192.168.1.6//Management machine Ipndbcluster//Storage engine [MYSQL_CLUSTER]NDB -connectstring=192.168.1.6//Management machine IP
4.sql Configuration on Nodes
[Email protected] ~]# VIM/ETC/MY.CNF
[Mysqld]log-binslow-query-logndbclusterdefault-storage-engine=ndbcluster//default storage engine specified as Ndbcluster[mysql_cluster] ndb-connectstring=192.168.1.6
5. Start the corresponding service on each server after the above configuration is done
[[email protected] ~]# ndb_mgmd-f/etc/config.ini// Management machine Start the management process
[[email protected] ~]# NDBD// Data node start data process
[[email protected] ~]# ndbd // Data node start data process
[[Email protected] ~]# service MySQL start on//sql node
[[Email protected] ~]# service MySQL start on //sql node
6. Verify cluster status on the management machine
[Email protected] ~]# NDB_MGM
ndb_mgm> showcluster Configuration---------------------[ndbd (NDB)]2 node (s) [email protected] (mysql-5.6.14 ndb-7.3.3, nodegroup:0, *)//default data node [email protected] (mysql-5.6.14 ndb-7.3.3, nodegroup:0)//normal backup, when the default node failure, to accept the Memory [NDB_MGMD (MGM)]1 node (s) [email protected] (mysql-5.6.14 ndb-7.3.3) [Mysqld (API)]2 node (s) [email protected] (mysql-5 .6.14 ndb-7.3.3) [email protected] (mysql-5.6.14 ndb-7.3.3)
This article is from the "Sleepcat" blog, make sure to keep this source http://sw5720.blog.51cto.com/8812314/1437566