[root@localhost ~]#cd /usr/local/MySQL/bin
[root@localhost bin]#./ndbd
启动SQL节点[192.168.133.62,192.168.133.100]:
[root@localhost mysql]# ./bin/mysqld_safe &
至此,所有节点已经启动完成,让我们来查看系统状态:
Cluster Configuration
---------------------
[ndbd(NDB)] 2 node(s)
id=2 @192.168.133.101 (Version: 7.1.10, Nodegroup: 0, Master)
id=3 @192.168.133.102 (Version: 7.1.10, Nodegroup: 0)
[ndb_mgmd(MGM)] 1 node(s)
id=1 @192.168.133.98 (Version: 7.1.10)
[mysqld(API)] 2 node(s)
id=4 @192.168.133.62 (Version: 7.1.10)
id=5 @192.168.133.100 (Version: 7.1.10)
--------------------------------------------------------------------------------
八:测试:
在192.168.133.62上执行以下命令:
#mysql
mysql> use ndbdatabase;
Database changed
mysql> create table test (id int) engine=ndb;
Query OK, 0 rows affected (0.10 sec)
mysql> show create table test\G;
*************************** 1. row ***************************
Table: test
Create Table: CREATE TABLE `test` (
`id` int(11) DEFAULT NULL
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
1 row in set (0.00 sec)
ERROR:
No query specified
mysql> insert into test values(1);
Query OK, 1 row affected (0.00 sec)
mysql> select * from test;
+------+
| id |
+------+
| 1 |
+------+
1 row in set (0.00 sec)
mysql>
在192.168.133.100上执行以下命令,验证以上操作:
[root@localhost test]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.1.51-ndb-7.1.10-log Source distribution
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| ndbdatabase |
| ndbinfo |
| test |
+--------------------+
5 rows in set (0.01 sec)
mysql> use ndbdatabase;
Database changed
mysql> show tables;
+-----------------------+
| Tables_in_ndbdatabase |
+-----------------------+
| test |
+-----------------------+
1 row in set (0.00 sec)
mysql> show create table test\G;
*************************** 1. row ***************************
Table: test
Create Table: CREATE TABLE `test` (
`id` int(11) DEFAULT NULL
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
1 row in set (0.02 sec)
ERROR:
No query specified
mysql> select * from test;
+------+
| id |
+------+
| 1 |
+------+
1 row in set (0.01 sec)
mysql>
验证表明,集群工作正常.
