[root@sqlnodeA mysql]# ./bin/mysql -uroot
Welcome to the MySQL monitor. Commands end with ; or g.
mysql> show databases ;
+——————–+
| Database |
+——————–+
| information_schema |
| mysql |
| test |
+——————–+
3 rows in set (0.01 sec)
mysql> create database cluster ;
Query OK, 1 row affected (0.18 sec)
mysql> use cluster ;
Database changed
mysql> create table test1(id int,name varchar(10)) engine=ndb ;
Query OK, 0 rows affected (0.03 sec)
mysql> insert into test1 values(1,’zhaoyun’);
Query OK, 1 row affected (0.00 sec)
mysql> select * from test1 ;
+——+———+
| id | name |
+——+———+
| 1 | zhaoyun |
+——+———+
1 row in set (0.00 sec)
mysql>现在是在SQL节点A上创建的数据库,下面从SQL节点B登录,查看效果。
[root@sqlnodeB mysql]# ./bin/mysql -uroot
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 4
Server version: 5.1.30-ndb-6.3.20-cluster-gpl MySQL Cluster Server (GPL)
Type ‘help;’ or ‘h’ for help. Type ‘c’ to clear the buffer.
mysql> show databases ;
+——————–+
| Database |
+——————–+
| information_schema |
| cluster |
| mysql |
| test |
+——————–+
4 rows in set (0.00 sec)
mysql> use cluster
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show tables ;
+——————-+
| Tables_in_cluster |
+——————-+
| test1 |
+——————-+
1 row in set (0.00 sec)
mysql> select * from test1 ;
+——+———+
| id | name |
+——+———+
| 1 | zhaoyun |
+——+———+
1 row in set (0.00 sec)
mysql> show create table test1 ;
+——-+———————————————————————————————————————————-+
| Table | Create Table |
+——-+———————————————————————————————————————————-+
| test1 | CREATE TABLE `test1` (
`id` int(11) DEFAULT NULL,
`name` varchar(10) DEFAULT NULL
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 |
+——-+———————————————————————————————————————————-+
1 row in set (0.00 sec)
mysql> insert into test1 values(2,’zhao’);
Query OK, 1 row affected (0.00 sec)
mysql> select * from test1 ;
+——+———+
| id | name |
+——+———+
| 1 | zhaoyun |
| 2 | zhao |
+——+———+
2 rows in set (0.00 sec)
现在看来,在SQL节点B登录,可以看到sql节点A创建的内容。那么,再从B创建内容看A是否能看到。
mysql> select * from test1 ;
+——+———+
| id | name |
+——+———+
| 1 | zhaoyun |
| 2 | zhao |
+——+———+
2 rows in set (0.00 sec) 在A节点也可以看到从B节点插入的数据了。
说明现在sql节点已经工作正常,因为数据存放在数据节点,任何一个坏掉,都不影响使用。
文章知识点与官方知识档案匹配,可进一步学习相关知识MySQL入门技能树首页概览32053 人正在系统学习中 相关资源:软件测试群软件测试群软件测试群软件测试群_测试群-其它文档类…
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!