Chinaunix首页 | 论坛 | 博客
  • 博客访问: 104488
  • 博文数量: 27
  • 博客积分: 1840
  • 博客等级: 上尉
  • 技术积分: 480
  • 用 户 组: 普通用户
  • 注册时间: 2006-08-09 11:07
文章分类

全部博文(27)

文章存档

2009年(2)

2008年(25)

我的朋友
最近访客

分类: LINUX

2008-08-25 10:17:56

要想关闭 Cluster,可在MGM节点所在的机器上,在Shell中简单地输入下述命令:/usr/local/mysql/ndb_mgm -e shutdown
关闭SQL节点的mysqld服务:/usr/local/mysql/bin/mysqladmin -uroot shutdown

管理节点启动 /usr/local/mysql/ndb_mgmd -f /usr/local/mysql/config.ini
测试环境运行情况 /usr/local/mysql/ndb_mgm

存储节点启动 /usr/local/mysql/bin/ndbd --initial(第一次启动时需要)
SQL节点启动 /usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/sql_my.cnf &

>SHOW

版本:這裏用的是5.0,因為在公司的時候很多後綴名的文件不允許下載,而我現在手上只有一個5.0帶集群的版本,因為就選這版本了.

管理节点(MGM)    192.168.1.191(db1)
SQL节点1(SQL1)    192.168.1.192(db2)
SQL节点2(SQL2)    192.168.1.193(db3)
数据节点1(NDBD1)  192.168.1.194(db4)
数据节点2(NDBD2)  192.168.1.194(db5)

#======================================== 安装管理节点 配置管理节点 vi /usr/local/mysql/config.ini ========================================

chkconfig --del iptables
service iptables stop

groupadd mysql
useradd -g mysql mysql

mkdir /usr/local/temp
mkdir /usr/local/mysql/
mkdir /usr/local/mysql/data/

cd /usr/local/temp
wget -d
unzip mysql5.0_NoCompiling.zip
rm -rf mysql5.0_NoCompiling.zip
mv mysql5.0_NoCompiling mysql
chown root:root /usr/local/temp
chmod -R 777 /usr/local/temp

cd /usr/local/temp/mysql/bin
cp ndb_mgm* /usr/local/mysql/
chown mysql:mysql /usr/local/mysql

 # 配置 vi /usr/local/mysql/config.ini

vi /usr/local/mysql/config.ini
[NDBD DEFAULT]
NoOfReplicas=2
[TCP DEFAULT]
portnumber=3306

[NDB_MGMD]
hostname=192.168.1.191
datadir=/usr/local/mysql/data/

[NDBD]
hostname=192.168.1.192
datadir=/usr/local/mysql/data/
[NDBD]
hostname=192.168.1.193
datadir=/usr/local/mysql/data/

[MYSQLD]
hostname=192.168.1.194
[MYSQLD]
hostname=192.168.1.195

 chmod -R 644 /usr/local/mysql/config.ini

#======================================== 安装SQL节点 安装存储节点 (2,3 || 3,4) ========================================

chkconfig --del iptables
service iptables stop

groupadd mysql
useradd -g mysql mysql

cd /usr/local
wget -d
unzip mysql5.0_NoCompiling.zip
rm -rf mysql5.0_NoCompiling.zip
mv mysql5.0_NoCompiling mysql
chown root:root /usr/local/temp
chmod -R 777 /usr/local/temp

chown mysql:root /usr/local/mysql/
chown mysql:mysql /usr/local/mysql/data

cd mysql
chmod -R 777 /usr/local/mysql
/usr/local/mysql/scripts/mysql_install_db --user=mysql

chown mysql:root /usr/local/mysql/
chown mysql:mysql /usr/local/mysql/data

#存储节点(NDB节点):
vi /etc/mdb_my.cnf
[mysqld]
ndbcluster
ndb-connectstring=192.168.1.191
[mysql_cluster]
ndb-connectstring=192.168.1.191

 chmod -R 644 /etc/mdb_my.cnf
 /usr/local/mysql/bin/ndbd --defaults-file=/etc/mdb_my.cnf --initial &

#配置SQL节点:
vi /etc/sql_my.cnf
[mysqld]
basedir = /usr/local/mysql/
datadir = /usr/local/mysql/data
user = mysql
port = 3306
socket = /tmp/mysql.sock
ndbcluster
ndb-connectstring=192.168.1.191
[MYSQL_CLUSTER]
ndb-connectstring=192.168.1.191

 chmod -R 644 /etc/sql_my.cnf

 /usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/sql_my.cnf &
 /usr/local/mysql/bin/mysql -h localhost -u root -p

 grant all privileges on *.* to identified by "111111" with grant option;
 grant all privileges on *.* to identified by "111111" with grant option;
 FLUSH PRIVILEGES;
 exit;

 /usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/sql_my.cnf &

阅读(849) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~