1. 为mysqld增加一个登录用户和组:--5个节点都要做此步骤
shell> groupadd mysql
shell> useradd -g mysql mysql
2.安装管理节点
shell> tar zxvf mysql-cluster-gpl-7.0.9-linux-i686-glibc23.tar.gz
shell> mv mysql-cluster-gpl-7.0.9-linux-i686-glibc23 /apps/mysql/mysql-cluster
创建MYSQL-CLUSTER目录,并配置CONFIG.INI文件
shell> mkdir /apps/mysql/mysql-cluster
shell> cd /apps/mysql/mysql-cluster
shell> vi config.ini
config.ini内容为下:
[ndbd default]
NoOfReplicas= 2
DataMemory=500M
indexMemory=300M
[tcp default]
SendBufferMemory=2M
ReceiveBufferMemory=2M
[ndb_mgmd default]
PortNumber=1186
Datadir=/apps/mysql/mysql-cluster
[ndb_mgmd]
Id=1
HostName=192.168.1.1
[ndbd]
Id=2
HostName= 192.168.1.2
DataDir= /apps/mysql/data
[ndbd]
Id=3
HostName= 192.168.1.3
DataDir= /apps/mysql/data
[mysqld]
Id=4
Hostname=192.168.1.4
[mysqld]
Id=5
Hostname=192.168.1.5
2.数据节点安装
shell> tar zxvf mysql-cluster-gpl-7.0.9-linux-i686-glibc23.tar.gz
shell> mv mysql-cluster-gpl-7.0.9-linux-i686-glibc23 /apps/mysql
编辑/etc/my.cnf
[mysqld]
ndbcluster
ndb-connectstring=192.168.1.1
[mysql_cluster]
ndb-connectstring=192.168.1.1
4.SQL节点安装
shell> tar zxvf mysql-cluster-gpl-7.0.9-linux-i686-glibc23.tar.gz
shell> mv mysql-cluster-gpl-7.0.9-linux-i686-glibc23 /apps/mysql
shell>cd /apps/mysql
shell> ./scripts/mysql_install_db --user=mysql
编辑/etc/my.cnf文件,添加内容如下。
[mysqld]
ndbcluster
ndb-connectstring=192.168.1.1
[mysql_cluster]
ndb-connectstring=192.168.1.1
启动管理节点
./bin/ndb_mgmd -f /apps/mysql/mysql-cluster/config.ini --configdir=/apps/mysql/mysql-cluster/ --ndb-nodeid=1
启动数据节点
./bin/ndbd --initial --ndb-connectstring=192.168.1.1:1186
启动sql节点
./bin/mysqld_safe -user=mysql &
登录数据库:
./bin/mysql -uroot -p --socket=/tmp/mysql.sock
分享到:
2010-10-24 11:29
浏览 1173
分类:数据库
评论