tailieunhanh - High Availability MySQL Cookbook phần 3

Bước tiếp theo là lựa chọn hàng này từ nút SQL khác trong cluster (Node 2), và sau đó chèn một hàng nút thứ hai: [root @ Node 2 ~] # mysql Chào mừng bạn đến với màn hình MySQL. Id kết nối MySQL của bạn là 2 Server phiên bản MySQL Cluster Server (GPL) Loại 'giúp đỡ' hoặc '\ h' để được giúp đỡ. Loại '\ c' để rõ ràng tuyên bố đầu vào hiện tại. | High Availability with MySQL Cluster------------------------------------------ mysql USE cluster_test Database changed mysql CREATE TABLE ctest i INT ENGINE NDBCLUSTER Query OK 0 rows affected sec mysql INSERT INTO ctest VALUES 1 Query OK 1 row affected sec mysql SELECT FROM ctest i 1 1 row in set 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 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 36 36 Chapter 1 test ----------------------- 4 rows in set 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 sec mysql SELECT from ctest ------ i ------ 1 ------ 1 row in set sec mysql INSERT INTO ctest VALUES 2 Query OK 1 row affected sec High Availability with MySQL Cluster----------------------------------------------------------------- Finally we return to the first node and check that the data inserted on node2 is visible. mysql SELECT FROM ctest ------- i ------- 2 1 ------- 2 rows in set sec mysql Congratulations The cluster works and you have created a table in it. You can repeat these tests while powering off the storage nodes and watch the cluster continue to work. With a single-cluster storage node powered off everything will continue to work except for the SQL node that was previously running on the powered-off mode of course . Restarting a MySQL Cluster without downtime One of the key aspects

TỪ KHÓA LIÊN QUAN