第五步,sql01拷贝运行脚本,添加可执行权限
[root@sql01 mysql]# cp support-files/mysql.server /etc/init.d/mysqld [root@sql01 mysql]# chmod +x /etc/init.d/mysqld
第六步,sql01创建数据目录,修改所有者和所属组
[root@sql01 mysql]# mkdir /var/lib/mysql-cluster [root@sql01 mysql]# chown mysql. !$ -R chown mysql. /var/lib/mysql-cluster -R [root@sql01 mysql]# ll -d /var/lib/mysql-cluster/ drwxr-xr-x 2 mysql mysql 4096 Nov 5 00:06 /var/lib/mysql-cluster/
第七步,sql01初始化数据库
[root@sql01 mysql]# /usr/local/mysql/scripts/mysql_install_db --user=mysql WARNING: The host 'sql01.host.com' could not be looked up with resolveip. This probably means that your libc libraries are not 100 % compatible with this binary MySQL version. The MySQL daemon, mysqld, should work normally with the exception that host name resolving will not work. This means that you should use IP addresses instead of hostnames when specifying MySQL privileges ! Installing MySQL system tables... 131105 0:07:32 [Warning] The syntax '--skip-locking' is deprecated and will be removed in a future release. Please use --skip-external-locking instead. OK Filling help tables... 131105 0:07:32 [Warning] The syntax '--skip-locking' is deprecated and will be removed in a future release. Please use --skip-external-locking instead. OK To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so, start the server, then issue the following commands: ./bin/mysqladmin -u root password 'new-password' ./bin/mysqladmin -u root -h sql01.host.com password 'new-password' Alternatively you can run: ./bin/mysql_secure_installation which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers. See the manual for more instructions. You can start the MySQL daemon with: cd . ; ./bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl cd ./mysql-test ; perl mysql-test-run.pl Please report any problems with the ./bin/mysqlbug script!
第八步,sql01启动mysql,并加入ndb
[root@sql01 mysql]# /etc/init.d/mysqld start Starting MySQL. SUCCESS! [root@sql01 mysql]# /usr/local/mysql/bin/ndb_mgm -- NDB Cluster -- Management Client -- ndb_mgm> show Connected to Management Server at: 192.168.1.11:1186 Cluster Configuration --------------------- [ndbd(NDB)] 2 node(s) id=2 @192.168.1.14 (mysql-5.1.44 ndb-7.1.4, Nodegroup: 0, Master) id=3 @192.168.1.15 (mysql-5.1.44 ndb-7.1.4, Nodegroup: 0) [ndb_mgmd(MGM)] 1 node(s) id=1 @192.168.1.11 (mysql-5.1.44 ndb-7.1.4) [mysqld(API)] 2 node(s) id=4 @192.168.1.12 (mysql-5.1.44 ndb-7.1.4) id=5 (not connected, accepting connect from 192.168.1.13)
第九步,sql02执行和sql01相同的操作,如下:
[root@sql02 ~]# groupadd -g 27 mysql [root@sql02 ~]# useradd -u 27 -g 27 -r -M -s /sbin/nologin mysql [root@sql02 ~]# id mysql uid=27(mysql) gid=27(mysql) groups=27(mysql) [root@sq