GBase 8a
运维管理
文章

GBase 8a v953集群Nolicense Free版 gcadmin管理练习

GBase用户3033
发表于2024-02-27 16:25:481291次浏览1个评论

GBase 8a集群管理操作练习

一、集群服务管理操作
1、目标:

了解集群各节点的角色和状态。

掌握服务进程的启停方法。

了解gcmonit的功能和效果。

2、操作内容:

① 查看集群状态
[gbase@167 gcinstall]$ gcadmin

CLUSTER STATE:         ACTIVE
VIRTUAL CLUSTER MODE:  NORMAL

====================================
| GBASE GCWARE CLUSTER INFORMATION |
====================================
| NodeName |  IpAddress   | gcware |
------------------------------------
| gcware1  | 172.16.9.167 |  OPEN  |
------------------------------------
| gcware2  | 172.16.9.168 |  OPEN  |
------------------------------------
| gcware3  | 172.16.9.169 |  OPEN  |
------------------------------------
======================================================
|       GBASE COORDINATOR CLUSTER INFORMATION        |
======================================================
|   NodeName   |  IpAddress   | gcluster | DataState |
------------------------------------------------------
| coordinator1 | 172.16.9.167 |   OPEN   |     0     |
------------------------------------------------------
| coordinator2 | 172.16.9.170 |   OPEN   |     0     |
------------------------------------------------------
=========================================================================================================
|                                    GBASE DATA CLUSTER INFORMATION                                     |
=========================================================================================================
| NodeName |                IpAddress                 | DistributionId | gnode | syncserver | DataState |
---------------------------------------------------------------------------------------------------------
|  node1   |               172.16.9.168               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node2   |               172.16.9.167               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node3   |               172.16.9.170               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node4   |               172.16.9.169               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
② 停止gcware节点集群服务
[gbase@167 gcinstall]$ gcware_services all stop
Stopping GCWareMonit success!
Stopping gcware :                                          [  OK  ]

③ 查看gcware节点集群服务状态
[gbase@167 gcinstall]$ gcware_services all info
/opt/gbase/172.16.9.167/gcware/sbin/gcware is stopped

④ 查看gcware节点集群状态
[gbase@167 gcinstall]$ gcadmin
CLUSTER STATE:         ACTIVE
VIRTUAL CLUSTER MODE:  NORMAL

====================================
| GBASE GCWARE CLUSTER INFORMATION |
====================================
| NodeName |  IpAddress   | gcware |
------------------------------------
| gcware1  | 172.16.9.167 | CLOSE  |
------------------------------------
| gcware2  | 172.16.9.168 |  OPEN  |
------------------------------------
| gcware3  | 172.16.9.169 |  OPEN  |
------------------------------------
======================================================
|       GBASE COORDINATOR CLUSTER INFORMATION        |
======================================================
|   NodeName   |  IpAddress   | gcluster | DataState |
------------------------------------------------------
| coordinator1 | 172.16.9.167 |   OPEN   |     0     |
------------------------------------------------------
| coordinator2 | 172.16.9.170 |   OPEN   |     0     |
------------------------------------------------------
=========================================================================================================
|                                    GBASE DATA CLUSTER INFORMATION                                     |
=========================================================================================================
| NodeName |                IpAddress                 | DistributionId | gnode | syncserver | DataState |
---------------------------------------------------------------------------------------------------------
|  node1   |               172.16.9.168               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node2   |               172.16.9.167               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node3   |               172.16.9.170               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node4   |               172.16.9.169               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------

⑤ 开启 gcware节点集群服务
[gbase@167 gcinstall]$ gcware_services all start
Starting gcware :                                          [  OK  ]
Starting GCWareMonit success!
集群状态恢复正常。

[gbase@167 gcinstall]$ gcadmin

CLUSTER STATE:         ACTIVE
VIRTUAL CLUSTER MODE:  NORMAL

====================================
| GBASE GCWARE CLUSTER INFORMATION |
====================================
| NodeName |  IpAddress   | gcware |
------------------------------------
| gcware1  | 172.16.9.167 |  OPEN  |
------------------------------------
| gcware2  | 172.16.9.168 |  OPEN  |
------------------------------------
| gcware3  | 172.16.9.169 |  OPEN  |
------------------------------------
======================================================
|       GBASE COORDINATOR CLUSTER INFORMATION        |
======================================================
|   NodeName   |  IpAddress   | gcluster | DataState |
------------------------------------------------------
| coordinator1 | 172.16.9.167 |   OPEN   |     0     |
------------------------------------------------------
| coordinator2 | 172.16.9.170 |   OPEN   |     0     |
------------------------------------------------------
=========================================================================================================
|                                    GBASE DATA CLUSTER INFORMATION                                     |
=========================================================================================================
| NodeName |                IpAddress                 | DistributionId | gnode | syncserver | DataState |
---------------------------------------------------------------------------------------------------------
|  node1   |               172.16.9.168               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node2   |               172.16.9.167               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node3   |               172.16.9.170               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node4   |               172.16.9.169               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------

⑥ 查看 gcluster和gnode节点集群服务
[gbase@167 gcinstall]$ gcluster_services all info
/opt/gbase/172.16.9.167/gcluster/server/bin/gclusterd is running
/opt/gbase/172.16.9.167/gcluster/server/bin/gcrecover is running
/opt/gbase/172.16.9.167/gnode/server/bin/gbased is running
/opt/gbase/172.16.9.167/gnode/server/bin/gc_sync_server is running

⑦ 停止 gcluster节点集群服务
[gbase@167 gcinstall]$  gcluster_services all stop
Stopping gcrecover :                                       [  OK  ]
Stopping gcluster :                                        [  OK  ]
Stopping gbase :                                          [  OK  ]
Stopping syncserver :                                      [  OK  ]
使用gcadmin查看集群状态
[gbase@167 gcinstall]$ gcadmin 
CLUSTER STATE:         ACTIVE
VIRTUAL CLUSTER MODE:  NORMAL

====================================
| GBASE GCWARE CLUSTER INFORMATION |
====================================
| NodeName |  IpAddress   | gcware |
------------------------------------
| gcware1  | 172.16.9.167 |  OPEN  |
------------------------------------
| gcware2  | 172.16.9.168 |  OPEN  |
------------------------------------
| gcware3  | 172.16.9.169 |  OPEN  |
------------------------------------
======================================================
|       GBASE COORDINATOR CLUSTER INFORMATION        |
======================================================
|   NodeName   |  IpAddress   | gcluster | DataState |
------------------------------------------------------
| coordinator1 | 172.16.9.167 |  CLOSE   |     0     |
------------------------------------------------------
| coordinator2 | 172.16.9.170 |   OPEN   |     0     |
------------------------------------------------------
=========================================================================================================
|                                    GBASE DATA CLUSTER INFORMATION                                     |
=========================================================================================================
| NodeName |                IpAddress                 | DistributionId | gnode | syncserver | DataState |
---------------------------------------------------------------------------------------------------------
|  node1   |               172.16.9.168               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node2   |               172.16.9.167               |       1        | CLOSE |   CLOSE    |     0     |
---------------------------------------------------------------------------------------------------------
|  node3   |               172.16.9.170               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node4   |               172.16.9.169               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------


⑧ 开启 gcluster节点集群服务
[gbase@167 gcinstall]$ gcluster_services all start
Starting gbase :                                           [  OK  ]
Starting syncserver :                                      [  OK  ]
Starting gcluster :                                        [  OK  ]
Starting gcrecover :                                       [  OK  ]

集群状态恢复正常。
[gbase@167 gcinstall]$ gcadmin
CLUSTER STATE:         ACTIVE
VIRTUAL CLUSTER MODE:  NORMAL

====================================
| GBASE GCWARE CLUSTER INFORMATION |
====================================
| NodeName |  IpAddress   | gcware |
------------------------------------
| gcware1  | 172.16.9.167 |  OPEN  |
------------------------------------
| gcware2  | 172.16.9.168 |  OPEN  |
------------------------------------
| gcware3  | 172.16.9.169 |  OPEN  |
------------------------------------
======================================================
|       GBASE COORDINATOR CLUSTER INFORMATION        |
======================================================
|   NodeName   |  IpAddress   | gcluster | DataState |
------------------------------------------------------
| coordinator1 | 172.16.9.167 |   OPEN   |     0     |
------------------------------------------------------
| coordinator2 | 172.16.9.170 |   OPEN   |     0     |
------------------------------------------------------
=========================================================================================================
|                                    GBASE DATA CLUSTER INFORMATION                                     |
=========================================================================================================
| NodeName |                IpAddress                 | DistributionId | gnode | syncserver | DataState |
---------------------------------------------------------------------------------------------------------
|  node1   |               172.16.9.168               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node2   |               172.16.9.167               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node3   |               172.16.9.170               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node4   |               172.16.9.169               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------

 

⑨ 关闭一个服务进程
[gbase@167 gcinstall]$ gcluster_services gbase stop
Stopping gbase :                                           [  OK  ]
[gbase@167 gcinstall]$ gcluster_services gbase info
/opt/gbase/172.16.9.167/gnode/server/bin/gbased is running
成功执行了关闭gnode服务进程,验证状态时却发现仍在运行中。
验证服务进程:
[gbase@167 gcinstall]$ gcadmin
CLUSTER STATE:         ACTIVE
VIRTUAL CLUSTER MODE:  NORMAL

====================================
| GBASE GCWARE CLUSTER INFORMATION |
====================================
| NodeName |  IpAddress   | gcware |
------------------------------------
| gcware1  | 172.16.9.167 |  OPEN  |
------------------------------------
| gcware2  | 172.16.9.168 |  OPEN  |
------------------------------------
| gcware3  | 172.16.9.169 |  OPEN  |
------------------------------------
======================================================
|       GBASE COORDINATOR CLUSTER INFORMATION        |
======================================================
|   NodeName   |  IpAddress   | gcluster | DataState |
------------------------------------------------------
| coordinator1 | 172.16.9.167 |   OPEN   |     0     |
------------------------------------------------------
| coordinator2 | 172.16.9.170 |   OPEN   |     0     |
------------------------------------------------------
=========================================================================================================
|                                    GBASE DATA CLUSTER INFORMATION                                     |
=========================================================================================================
| NodeName |                IpAddress                 | DistributionId | gnode | syncserver | DataState |
---------------------------------------------------------------------------------------------------------
|  node1   |               172.16.9.168               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node2   |               172.16.9.167               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node3   |               172.16.9.170               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node4   |               172.16.9.169               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------


[gbase@167 gcinstall]$ gcmonit --stop
Stopping gcmonit success!
停止gcmonit服务后,再次关闭gnode服务进程。
[gbase@167 gcinstall]$ gcluster_services gbase stop
Stopping gbase :                                           [  OK  ]
[gbase@167 gcinstall]$ gcluster_services gbase info
/opt/gbase/172.16.9.167/gnode/server/bin/gbased is stopped
此次,gnode服务进程可以关闭了。
[gbase@167 ~]$ gcadmin
CLUSTER STATE:         ACTIVE
VIRTUAL CLUSTER MODE:  NORMAL

====================================
| GBASE GCWARE CLUSTER INFORMATION |
====================================
| NodeName |  IpAddress   | gcware |
------------------------------------
| gcware1  | 172.16.9.167 |  OPEN  |
------------------------------------
| gcware2  | 172.16.9.168 |  OPEN  |
------------------------------------
| gcware3  | 172.16.9.169 |  OPEN  |
------------------------------------
======================================================
|       GBASE COORDINATOR CLUSTER INFORMATION        |
======================================================
|   NodeName   |  IpAddress   | gcluster | DataState |
------------------------------------------------------
| coordinator1 | 172.16.9.167 |   OPEN   |     0     |
------------------------------------------------------
| coordinator2 | 172.16.9.170 |   OPEN   |     0     |
------------------------------------------------------
=========================================================================================================
|                                    GBASE DATA CLUSTER INFORMATION                                     |
=========================================================================================================
| NodeName |                IpAddress                 | DistributionId | gnode | syncserver | DataState |
---------------------------------------------------------------------------------------------------------
|  node1   |               172.16.9.168               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node2   |               172.16.9.167               |       1        | CLOSE |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node3   |               172.16.9.170               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node4   |               172.16.9.169               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------

⑩ 开启gcmonit 工具
[gbase@167 ~]$ gcmonit --start
Starting gcmonit success!
Starting gbase :                                           [  OK  ]
打开gcmonit成功,gnode进程被自动拉起。

验证服务进程:
[gbase@167 gcinstall]$ gcadmin
CLUSTER STATE:         ACTIVE
VIRTUAL CLUSTER MODE:  NORMAL
====================================
| GBASE GCWARE CLUSTER INFORMATION |
====================================
| NodeName |  IpAddress   | gcware |
------------------------------------
| gcware1  | 172.16.9.167 |  OPEN  |
------------------------------------
| gcware2  | 172.16.9.168 |  OPEN  |
------------------------------------
| gcware3  | 172.16.9.169 |  OPEN  |
------------------------------------
======================================================
|       GBASE COORDINATOR CLUSTER INFORMATION        |
======================================================
|   NodeName   |  IpAddress   | gcluster | DataState |
------------------------------------------------------
| coordinator1 | 172.16.9.167 |   OPEN   |     0     |
------------------------------------------------------
| coordinator2 | 172.16.9.170 |   OPEN   |     0     |
------------------------------------------------------
=========================================================================================================
|                                    GBASE DATA CLUSTER INFORMATION                                     |
=========================================================================================================
| NodeName |                IpAddress                 | DistributionId | gnode | syncserver | DataState |
---------------------------------------------------------------------------------------------------------
|  node1   |               172.16.9.168               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node2   |               172.16.9.167               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node3   |               172.16.9.170               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node4   |               172.16.9.169               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------

通过演示结果可以证明gcmonit监控gnode服务进程,一旦服务进程意外关闭,gcmonit会自动将其拉起。只有gcmonit监控被关闭,才能手动关闭gnode等进程。

 

二、集群模式修改操作
1、目标:
了解只读模式和恢复模式对数据库操作的影响。
2、操作内容:

使用gcadmin switchmode readonly,然后使用gcadmin查看集群状态变化。使用gcadmin switchmode normal,使集群模式恢复正常。
1)修改集群模式为只读
[gbase@167 ~]$ gcadmin switchmode readonly
========== switch cluster mode...
 switch pre mode:                 [NORMAL]
 switch mode to                   [READONLY]
 switch after mode:                 [READONLY]

[gbase@167 ~]$ gcadmin
CLUSTER STATE:         ACTIVE
VIRTUAL CLUSTER MODE:  READONLY
====================================
| GBASE GCWARE CLUSTER INFORMATION |
====================================
| NodeName |  IpAddress   | gcware |
------------------------------------
| gcware1  | 172.16.9.167 |  OPEN  |
------------------------------------
| gcware2  | 172.16.9.168 |  OPEN  |
------------------------------------
| gcware3  | 172.16.9.169 |  OPEN  |
------------------------------------
======================================================
|       GBASE COORDINATOR CLUSTER INFORMATION        |
======================================================
|   NodeName   |  IpAddress   | gcluster | DataState |
------------------------------------------------------
| coordinator1 | 172.16.9.167 |   OPEN   |     0     |
------------------------------------------------------
| coordinator2 | 172.16.9.170 |   OPEN   |     0     |
------------------------------------------------------
=========================================================================================================
|                                    GBASE DATA CLUSTER INFORMATION                                     |
=========================================================================================================
| NodeName |                IpAddress                 | DistributionId | gnode | syncserver | DataState |
---------------------------------------------------------------------------------------------------------
|  node1   |               172.16.9.168               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node2   |               172.16.9.167               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node3   |               172.16.9.170               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node4   |               172.16.9.169               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
对数据库写操作
[gbase@167 ~]$ gccli -uroot
GBase client 9.5.3.28.84c16ae5. Copyright (c) 2004-2024, GBase.  All Rights Reserved.
gbase> create database testdb;
注:此时由于集群处于readonly模式,该SQL被阻塞执行。
在另一管理节点切换集群模式为normal:
[gbase@node170 ~]$ gcadmin switchmode normal
========== switch cluster mode...
 switch pre mode:                 [READONLY]
 switch mode to                   [NORMAL]
 switch after mode:                 [NORMAL]
等待一段时间,node167阻塞的SQL命令会继续执行,无需人为干预。其执行结果如下:
Query OK, 1 row affected (Elapsed: 00:05:00.16)
验证testdb库创建是否成功:
gbase> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| performance_schema |
| gbase              |
| gctmpdb            |
| gclusterdb         |
| testdb             |
+--------------------+
6 rows in set (Elapsed: 00:00:00.01)
2)修改集群模式为recovery
[gbase@node167 ~]$ gcadmin switchmode recovery
========== switch cluster mode...
 switch pre mode:                 [NORMAL]
 switch mode to                   [RECOVERY]
 switch after mode:                 [RECOVERY]
[gbase@node167 ~]$ gcadmin
CLUSTER STATE:         ACTIVE
VIRTUAL CLUSTER MODE:  RECOVERY

====================================
| GBASE GCWARE CLUSTER INFORMATION |
====================================
| NodeName |  IpAddress   | gcware |
------------------------------------
| gcware1  | 172.16.9.167 |  OPEN  |
------------------------------------
| gcware2  | 172.16.9.168 |  OPEN  |
------------------------------------
| gcware3  | 172.16.9.169 |  OPEN  |
------------------------------------
======================================================
|       GBASE COORDINATOR CLUSTER INFORMATION        |
======================================================
|   NodeName   |  IpAddress   | gcluster | DataState |
------------------------------------------------------
| coordinator1 | 172.16.9.167 |   OPEN   |     0     |
------------------------------------------------------
| coordinator2 | 172.16.9.170 |   OPEN   |     0     |
------------------------------------------------------
=========================================================================================================
|                                    GBASE DATA CLUSTER INFORMATION                                     |
=========================================================================================================
| NodeName |                IpAddress                 | DistributionId | gnode | syncserver | DataState |
---------------------------------------------------------------------------------------------------------
|  node1   |               172.16.9.168               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node2   |               172.16.9.167               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node3   |               172.16.9.170               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node4   |               172.16.9.169               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------

[gbase@167 ~]$ gccli -uroot
GBase client 9.5.3.28.84c16ae5. Copyright (c) 2004-2024, GBase.  All Rights Reserved.
gbase> use testdb;
Query OK, 0 rows affected (Elapsed: 00:00:00.00)
gbase> select database();
ERROR 1707 (HY000): gcluster command error: (GBA-02CO-0002) Currently,gcluster is at recovery mode,current operation isn't allowed.
gbase>exit
[gbase@node167 ~]$ gcadmin switchmode normal
========== switch cluster mode...
 switch pre mode:                 [RECOVERY]
 switch mode to                   [NORMAL]
 switch after mode:                 [NORMAL]
[gbase@node173 ~]$ gcadmin
CLUSTER STATE:         ACTIVE
VIRTUAL CLUSTER MODE:  NORMAL
====================================
| GBASE GCWARE CLUSTER INFORMATION |
====================================
| NodeName |  IpAddress   | gcware |
------------------------------------
| gcware1  | 172.16.9.167 |  OPEN  |
------------------------------------
| gcware2  | 172.16.9.168 |  OPEN  |
------------------------------------
| gcware3  | 172.16.9.169 |  OPEN  |
------------------------------------
======================================================
|       GBASE COORDINATOR CLUSTER INFORMATION        |
======================================================
|   NodeName   |  IpAddress   | gcluster | DataState |
------------------------------------------------------
| coordinator1 | 172.16.9.167 |   OPEN   |     0     |
------------------------------------------------------
| coordinator2 | 172.16.9.170 |   OPEN   |     0     |
------------------------------------------------------
=========================================================================================================
|                                    GBASE DATA CLUSTER INFORMATION                                     |
=========================================================================================================
| NodeName |                IpAddress                 | DistributionId | gnode | syncserver | DataState |
---------------------------------------------------------------------------------------------------------
|  node1   |               172.16.9.168               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node2   |               172.16.9.167               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node3   |               172.16.9.170               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node4   |               172.16.9.169               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------

[gbase@167 ~]$ gccli -uroot
GBase client 9.5.3.28.84c16ae5. Copyright (c) 2004-2024, GBase.  All Rights Reserved.
gbase> use testdb;
gbase>select database();
+------------+
| database() |
+------------+
| testdb    |
+------------+
1 row in set (Elapsed: 00:00:00.00)
 

三、集群管理日志

1、目标:
了解DDL日志和DML日志产生的原因。
能够解读DDL日志和DML日志的内容。
了解节点同步后DDL日志和DML日志的变化。
2、操作内容:
1)关闭一个集群节点的服务
[gbase@167 ~]$  gcluster_services all stop
Stopping gcrecover :                                       [  OK  ]
Stopping gcluster :                                        [  OK  ]
Stopping gbase :                                           [  OK  ]
Stopping syncserver :                                      [  OK  ]

[gbase@167 ~]$ gcadmin
CLUSTER STATE:         ACTIVE
VIRTUAL CLUSTER MODE:  NORMAL

====================================
| GBASE GCWARE CLUSTER INFORMATION |
====================================
| NodeName |  IpAddress   | gcware |
------------------------------------
| gcware1  | 172.16.9.167 |  OPEN  |
------------------------------------
| gcware2  | 172.16.9.168 |  OPEN  |
------------------------------------
| gcware3  | 172.16.9.169 |  OPEN  |
------------------------------------
======================================================
|       GBASE COORDINATOR CLUSTER INFORMATION        |
======================================================
|   NodeName   |  IpAddress   | gcluster | DataState |
------------------------------------------------------
| coordinator1 | 172.16.9.167 |  CLOSE   |     0     |
------------------------------------------------------
| coordinator2 | 172.16.9.170 |   OPEN   |     0     |
------------------------------------------------------
=========================================================================================================
|                                    GBASE DATA CLUSTER INFORMATION                                     |
=========================================================================================================
| NodeName |                IpAddress                 | DistributionId | gnode | syncserver | DataState |
---------------------------------------------------------------------------------------------------------
|  node1   |               172.16.9.168               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node2   |               172.16.9.167               |       1        | CLOSE |   CLOSE    |     0     |
---------------------------------------------------------------------------------------------------------
|  node3   |               172.16.9.170               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node4   |               172.16.9.169               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------


① DDLevent日志
[gbase@170 ~]$ gcadmin switchmode normal
========== switch cluster mode...
 switch pre mode:                 [READONLY]
 switch mode to                   [NORMAL]
 switch after mode:                 [NORMAL]
[gbase@170 ~]$ gccli -uroot
GBase client 9.5.3.28.84c16ae5. Copyright (c) 2004-2024, GBase.  All Rights Reserved.
gbase>  drop database testdb;
Query OK, 0 rows affected (Elapsed: 00:00:00.13)
查看集群状态:
[gbase@170 ~]$ gcadmin
CLUSTER STATE:         ACTIVE
VIRTUAL CLUSTER MODE:  NORMAL
====================================
| GBASE GCWARE CLUSTER INFORMATION |
====================================
| NodeName |  IpAddress   | gcware |
------------------------------------
| gcware1  | 172.16.9.167 |  OPEN  |
------------------------------------
| gcware2  | 172.16.9.168 |  OPEN  |
------------------------------------
| gcware3  | 172.16.9.169 |  OPEN  |
------------------------------------
======================================================
|       GBASE COORDINATOR CLUSTER INFORMATION        |
======================================================
|   NodeName   |  IpAddress   | gcluster | DataState |
------------------------------------------------------
| coordinator1 | 172.16.9.167 |  CLOSE   |     1     |
------------------------------------------------------
| coordinator2 | 172.16.9.170 |   OPEN   |     0     |
------------------------------------------------------
=========================================================================================================
|                                    GBASE DATA CLUSTER INFORMATION                                     |
=========================================================================================================
| NodeName |                IpAddress                 | DistributionId | gnode | syncserver | DataState |
---------------------------------------------------------------------------------------------------------
|  node1   |               172.16.9.168               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node2   |               172.16.9.167               |       1        | CLOSE |   CLOSE    |     1     |
---------------------------------------------------------------------------------------------------------
|  node3   |               172.16.9.170               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node4   |               172.16.9.169               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------

查看DDLevent日志:
[gbase@170 ~]$ gcadmin showddlevent
Vc event count:1
Event ID:    5
ObjectName: testdb
Fail Node Copy:
------------------------------------------------------
NodeID: 2802389164      NodeIP:172.16.9.167     FAILURE

Fail Data Copy:
------------------------------------------------------
NodeIP: 172.16.9.167    FAILURE

创建一个新库:
[gbase@170 ~]$ gccli -uroot
GBase client 9.5.3.28.84c16ae5. Copyright (c) 2004-2024, GBase.  All Rights Reserved.
gbase> create database testdb1;
Query OK, 1 row affected (Elapsed: 00:00:00.07)
gbase> create database testdb1;
在新库内创建一张新表:
gbase>use testdb1;
gbase> create table student( sno varchar(20),sname varchar(20),ssex varchar(3),sage int(4),sdept varchar(20));
插入数据:
gbase> insert into student values ('200215121','liyong','F',20,'CS');
查看DDLevent日志:
[gbase@170 ~]$ gcadmin showddlevent
Vc event count:3
Event ID:    5
ObjectName: testdb
Fail Node Copy:
------------------------------------------------------
NodeID: 2802389164      NodeIP:172.16.9.167     FAILURE

Fail Data Copy:
------------------------------------------------------
NodeIP: 172.16.9.167    FAILURE

Event ID:    6
ObjectName: testdb1
Fail Node Copy:
------------------------------------------------------
NodeID: 2802389164      NodeIP:172.16.9.167     FAILURE

Fail Data Copy:
------------------------------------------------------
NodeIP: 172.16.9.167    FAILURE

Event ID:    7
ObjectName: testdb1.student
Fail Node Copy:
------------------------------------------------------
NodeID: 2802389164      NodeIP:172.16.9.167     FAILURE

Fail Data Copy:
------------------------------------------------------
SegName: n2     NodeIP: 172.16.9.167    FAILURE
SegName: n6     NodeIP: 172.16.9.167    FAILURE
SegName: n1     NodeIP: 172.16.9.167    FAILURE
SegName: n8     NodeIP: 172.16.9.167    FAILURE

② DMLevent日志
[gbase@170 ~]$ gcadmin showdmlevent;
Vc event count:1
Event ID:    4
ObjectName: testdb1.student

Fail Data Copy:
------------------------------------------------------
SegName: n2     SCN: 4100       NodeIP: 172.16.9.167    FAILURE

2)恢复故障节点
[gbase@167 ~]$ gcluster_services all start
Starting gbase :                                           [  OK  ]
Starting syncserver :                                      [  OK  ]
Starting gcluster :                                        [  OK  ]
Starting gcrecover :                                       [  OK  ]


注:系统自动进行数据同步,略等一段时间,DataState状态由“1”转变为“0”。

[gbase@167 ~]$ gcadmin
CLUSTER STATE:         ACTIVE
VIRTUAL CLUSTER MODE:  NORMAL

====================================
| GBASE GCWARE CLUSTER INFORMATION |
====================================
| NodeName |  IpAddress   | gcware |
------------------------------------
| gcware1  | 172.16.9.167 |  OPEN  |
------------------------------------
| gcware2  | 172.16.9.168 |  OPEN  |
------------------------------------
| gcware3  | 172.16.9.169 |  OPEN  |
------------------------------------
======================================================
|       GBASE COORDINATOR CLUSTER INFORMATION        |
======================================================
|   NodeName   |  IpAddress   | gcluster | DataState |
------------------------------------------------------
| coordinator1 | 172.16.9.167 |   OPEN   |     0     |
------------------------------------------------------
| coordinator2 | 172.16.9.170 |   OPEN   |     0     |
------------------------------------------------------
=========================================================================================================
|                                    GBASE DATA CLUSTER INFORMATION                                     |
=========================================================================================================
| NodeName |                IpAddress                 | DistributionId | gnode | syncserver | DataState |
---------------------------------------------------------------------------------------------------------
|  node1   |               172.16.9.168               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node2   |               172.16.9.167               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node3   |               172.16.9.170               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------
|  node4   |               172.16.9.169               |       1        | OPEN  |    OPEN    |     0     |
---------------------------------------------------------------------------------------------------------

[gbase@node170 ~]$ gcadmin showddlevent;
Vc event count:0

[gbase@node170 ~]$ gcadmin showdmlevent;
Vc event count:0

评论

登录后才可以发表评论
GBase用户27068发表于 4个月前
学习了!