一、环境准备:
注:所有节点需要将其防墙关闭
/etc/init.d/iptables status #查看防火墙状态
/etc/init.d/iptables stop #关闭防火墙
选择 mysql-cluster-gpl-7.1.19.tar.gz 下载
2.硬件需要五台物理节点(虚拟机上试过不行)
3.软件安装:在所有节点上做如下操作
######################################################################################################
groupadd mysql#创建mysql组
useradd -g mysql mysql#创建mysql用户
#创建目录
mkdir -p /opt/mysql-cluster
mkdir -p /opt/mysql-cluster/etc
mkdir -p /opt/mysql-cluster/tmp
mkdir -p /opt/mysql-cluster/data
#解压软件包
tar zxvf mysql-cluster-gpl-7.1.19.tar.gz
#配置安装项 安装mysql
cd mydql-cluster-gpl-7.1.19
./configure --prefix=/opt/mysql-cluster --with-charset=gbk --with-collation=gbk_chinese_ci --with-client-ldflags=-all-static -with-mysqld-ldflags=-all-static --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile --with-unix-socket-path=/opt/mysql-cluster/tmp/mysql.sock --sysconfdir=/opt/mysql-cluster/etc --without-debug --with-mysqld-user=mysql --with-plugins=max
#安装
make && make install
######################################################################################################
二、管理节点配置
1.创建管理节点的集群配置文件config.ini
[root@sg204 mysql-cluster]# vi etc/config.ini
[NDBD DEFAULT]
NoOfReplicas= 2
[MYSQLD DEFAULT]
[NDB_MGMD DEFAULT]
DataDir=/opt/mysql-cluster/data #数据存放目录
[NDB_MGMD]
HostName= 10.30.9.204
[NDBD]
HostName= 10.30.9.206
DataDir=/opt/mysql-cluster/data
[NDBD]
HostName= 10.30.9.207
Datadir=/opt/mysql-cluster/data
[MYSQLD]
HostName= 10.30.9.208
[MYSQLD]
HostName= 10.30.9.211
2.在管理节点上启动ndb_mgmd服务
[root@sg204 mysql-cluster]#libexec/ndb_mgmd -f etc/config.ini
MySQL Cluster Management Server mysql-5.1.56 ndb-7.1.19
这时ndb_mgmd服务已经启动了,可以 用ps命令查看其进程:
[root@sg204 mysql-cluster]# ps -ef | grep ndb
root 23505 1 0 May11 ? 00:00:00 libexec/ndb_mgmd -f etc/config.ini
root 24692 242