Thư viện tri thức trực tuyến
Kho tài liệu với 50,000+ tài liệu học thuật
© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

High Availability MySQL Cookbook phần 3 docx
Nội dung xem thử
Mô tả chi tiết
High Availability with MySQL Cluster
36
mysql> USE cluster_test;
Database changed
mysql> CREATE TABLE ctest (i INT) ENGINE=NDBCLUSTER;
Query OK, 0 rows affected (0.84 sec)
mysql> INSERT INTO ctest () VALUES (1);
Query OK, 1 row affected (0.04 sec)
mysql> SELECT * FROM ctest;
+------+
| i |
+------+
| 1 |
+------+
1 row in set (0.00 sec)
The next step is to select this row from the other SQL node in the cluster (node2), and then
insert another row from the second node:
[root@node2 ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.34-ndb-7.0.6-cluster-gpl MySQL Cluster Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the current input
statement.
mysql> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| cluster_test |
| mysql |
Chapter 1
37
| test |
+--------------------+
4 rows in set (0.03 sec)
mysql> use cluster_test;
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_test |
+------------------------+
| ctest |
+------------------------+
1 row in set (0.04 sec)
mysql> SELECT * from ctest;
+------+
| i |
+------+
| 1 |
+------+
1 row in set (0.00 sec)
mysql> INSERT INTO ctest () VALUES (2);
Query OK, 1 row affected (0.01 sec)