Rpm包安装mysql-cluster
sql节点ip地址:192.168.1.131 192.168.1.35
ndb数据节点地址:192.168.1.150 192.168.1.152
管理节点IP地址:192.168.1.10
管理节点 安装
rpm -ivh MySQL-Cluster-server-gpl-7.2.8-1.el6.x86_64.rpm
ndb节点 安装
rpm -ivh MySQL-Cluster-server-gpl-7.2.8-1.el6.x86_64.rpm
sql节点 安装
rpm -ivh MySQL-Cluster-server-gpl-7.2.8-1.el6.x86_64.rpm
rpm -ivh MySQL-Cluster-client-gpl-7.2.8-1.el6.x86_64.rpm
管理节点 配置
mkdir /var/lib/mysql-cluster/
cd /var/lib/mysql-cluster/
vi config.ini
[ndbd default]
NoOfReplicas=2
DataMemory=80M
IndexMemory=18M
[ndb_mgmd]
nodeid=1 centos5.4的时候是id=1
hostname=192.168.1.10
datadir=/var/lib/mysql-cluster
[ndbd]
nodeid=2
hostname=192.168.1.152
datadir=/usr/local/mysql/data
[ndbd]
nodeid=3
hostname=192.168.1.150
datadir=/usr/local/mysql/data
[mysqld]
nodeid=4
hostname=192.168.1.131
[mysqld]
nodeid=5
hostname=192.168.1.135
[mysqld]
sql节点和ndb节点配置
vi /etc/my.cnf
[mysqld]
ndbcluster
ndb-connectstring=192.168.1.10
[mysql_cluster] 记住是mysql_cluster不是mysqld_cluster
ndb-connectstring=192.168.1.10
各个服务器启动
1、首先启动管理节点
ndb_mgmd -f /var/lib/mysql-cluster/config.ini --initial
ndb_mgmd 启动管理节点
ndb_mgm -e show
或者
ndb_mgm
> show
[root@desktop1 lib]# ndb_mgm -e show
Connected to Management Server at: localhost:1186
Cluster Configuration
---------------------
[ndbd(NDB)] 2 node(s)
id=2 @192.168.1.152 (mysql-5.5.27 ndb-7.2.8, Nodegroup: 0, Master)
id=3 @192.168.1.150 (mysql-5.5.27 ndb-7.2.8, Nodegroup: 0)
[ndb_mgmd(MGM)] 1 node(s)
id=1 @192.168.1.10 (mysql-5.5.27 ndb-7.2.8)
[mysqld(API)] 3 node(s)
id=4 @192.168.1.131 (mysql-5.5.27 ndb-7.2.8)
id=5 @192.168.1.135 (mysql-5.5.27 ndb-7.2.8)
id=6 @192.168.1.150 (mysql-5.5.27 ndb-7.2.8)
2、在启动数据节点
ndbd --initial
3、sql节点
/etc/init.d/mysql start
转载于:https://blog.51cto.com/sunchao/1065436