4.8 测试
第一步,sql02创建测试数据库,sql01可以发现
[root@sql02 mysql]# /usr/local/mysql/bin/mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.1.44-ndb-7.1.4b-cluster-gpl-log MySQL Cluster Server (GPL) Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> create database larrydb; Query OK, 1 row affected (0.21 sec) mysql> [root@sql01 mysql]# /usr/local/mysql/bin/mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.1.44-ndb-7.1.4b-cluster-gpl-log MySQL Cluster Server (GPL) Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | larrydb | | mysql | | ndbinfo | | test | +--------------------+ 5 rows in set (0.00 sec)
第二步,sql01创建测试表,插入测试数据,sql02可以发现变化
mysql> use larrydb; Database changed mysql> create table user(id int,name varchar(30)); Query OK, 0 rows affected (0.62 sec) mysql> insert into user values(1,'larry'); Query OK, 1 row affected (0.03 sec) sql02 mysql> select * from larrydb.user; +------+-------+ | id | name | +------+-------+ | 1 | larry | +------+-------+ 1 row in set (0.04 sec)
如果只能使用三台服务器,可以这样配置:sql节点和ndb节点放在一起。管理节点做如下配置:
#管理节点 [ndb_mgmd] Id=1 HostName= 192.168.1.11 [ndbd] Id= 2 HostName= 192.168.1.14 [ndbd] Id= 3 HostName= 192.168.1.15 [mysqld] Id= 4 [mysqld] Id= 5 #其他节点做sql节点的配置即可