参考:http://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-install-linux-binary.html
实验 虚拟机4台 192.168.1.103 centosvm003 MySQL服务器(SQL)节点 192.168.1.104 centosvm004 数据(NDBD)节点”A” 192.168.1.105 centosvm005 数据(NDBD)节点”B” 192.168.1.106 centosvm006 管理(MGM)节点
MySQL服务器(SQL)节点 1、添加用户组及用户 shell> groupadd mysql shell> useradd -g mysql mysql
2、上传文件mysql-cluster-gpl-7.3.6-linux-glibc2.5-x86_64.tar.gz至/var/tmp目录 3、进行解压并创建链接 shell> cd /var/tmp shell> tar -C /usr/local -xzvf mysql-cluster-gpl-7.3.6-linux-glibc2.5-x86_64.tar.gz shell> ln -s /usr/local/mysql-cluster-gpl-7.3.6-linux-glibc2.5-x86_64 /usr/local/mysql
4、安装 shell> cd /usr/local/mysql shell> scripts/mysql_install_db –user=mysql
5、设置权限 shell> chown -R root . shell> chown -R mysql data shell> chgrp -R mysql .
6、加入启动设置 shell> cp support-files/mysql.server /etc/rc.d/init.d/ shell> chmod +x /etc/rc.d/init.d/mysql.server shell> chkconfig –add mysql.server
数据(NDBD)节点 1、添加用户组及用户 shell> groupadd mysql shell> useradd -g mysql mysql 2、上传文件mysql-cluster-gpl-7.3.6-linux-glibc2.5-x86_64.tar.gz至/var/tmp目录 3、解压并把命令放到/usr/local/bin/中,并执行可运行 shell> cd /var/tmp shell> tar -zxvf mysql-cluster-gpl-7.3.6-linux-glibc2.5-x86_64.tar.gz shell> cd mysql-cluster-gpl-7.3.6-linux-glibc2.5-x86_64 shell> cp bin/ndbd /usr/local/bin/ndbd shell> cp bin/ndbmtd /usr/local/bin/ndbmtd
管理(MGM)节点 1、添加用户组及用户 shell> groupadd mysql shell> useradd -g mysql mysql 2、上传文件mysql-cluster-gpl-7.3.6-linux-glibc2.5-x86_64.tar.gz至/var/tmp目录 3、解压并把命令放到/usr/local/bin/中,并执行可运行 shell> cd /var/tmp shell> tar -zxvf mysql-cluster-gpl-7.3.6-linux-glibc2.5-x86_64.tar.gz shell> cd mysql-cluster-gpl-7.3.6-linux-glibc2.5-x86_64 shell> cp bin/ndb_mgm* /usr/local/bin shell> cd /usr/local/bin shell> chmod +x ndb_mgm*
配置: MySQL服务器(SQL)节点 shell> vi /etc/my.cnf
[mysqld]
Options for mysqld process:
ndbcluster # run NDB storage engine
[mysql_cluster]
Options for MySQL Cluster processes:
ndb-connectstring=centosvm006 # location of management server
数据(NDBD)节点 shell> vi /etc/my.cnf
[mysqld]
Options for mysqld process:
ndbcluster # run NDB storage engine
[mysql_cluster]
Options for MySQL Cluster processes:
ndb-connectstring=centosvm006 # location of management server
配置及启动后台守护进程 管理(MGM)节点 shell> mkdir /var/lib/mysql-cluster shell> cd /var/lib/mysql-cluster shell> vi config.ini
启动,必须创建/usr/local/mysql/mysql-cluster目录,不知道为什么,官方文档没有说明需要创建,但是测试的时候报错 ndb_mgmd -f /var/lib/mysql-cluster/config.ini
注意:关闭所有相关节点的防火墙,service iptables stop,否则会出现异常
数据(NDBD)节点 shell> ndbd,
MySQL服务器(SQL)节点 shell> service mysql.server start
如果提示没有显示对应的sql节点,则需要在config.ini加一个空的mysqld节点即可,并关闭集群和重启上述三个节点即可。