6、在两个节点测试
|
[root@sqltest01 ~]# mysql -uroot -p
|
|
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 2
Server version: 5.6.21-ndb-7.3.7-cluster-gpl MySQL Cluster Community Server (GPL)
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
mysql> create database mydb1;
Query OK, 1 row affected (0.07 sec)
mysql> use mydb1;
Database changed
mysql> create table mytb1(id int,birthdate datetime,pername char(10)) engine=ndbcluster;
Query OK, 0 rows affected (0.19 sec)
|
|
mysql> insert into mytb1(id,birthdate,pername) values(1,'2013-01-23 09:45:10','pengzitong');
|
|
Query OK, 1 row affected (0.00 sec)
mysql> commit;
Query OK, 0 rows affected (0.00 sec)
mysql> insert into mytb1(id,birthdate,pername) values(2,'2007-07-09 09:45:10','pengzixin');
Query OK, 1 row affected (0.00 sec)
|
|
Query OK, 0 rows affected (0.00 sec)
|
在第二节点检查
|
[root@sqltest02 ~]# mysql -uroot -p
|
|
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 2
Server version: 5.6.21-ndb-7.3.7-cluster-gpl MySQL Cluster Community Server (GPL)
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
mysql> use mydb1
mysql> select * from mytb1;
+------+---------------------+------------+
| id | birthdate | pername |
+------+---------------------+------------+
| 1 | 2013-01-23 09:45:10 | pengzitong |
| 2 | 2007-07-09 09:45:10 | pengzixin |
+------+---------------------+------------+
|
7、集群停止
要想关闭 Cluster,可在MGM节点所在的机器上,在Shell中简单地输入下述命令:
|
[root@sqltest03 bin]# /usr/local/mysql/ndb_mgm -e shutdown
|
运行以下命令关闭SQL节点的mysqld服务:
|
[root@sqltest01 bin]# /usr/local/mysql/bin/mysqladmin -uroot shutdown |
您可能感兴趣的文章:
mysql ndb集群备份数据库和还原数据库的方法具有负载均衡功能的MySQL服务器集群部署及实现nginx+apache+mysql+php+memcached+squid搭建集群web环境