南大通用GBase 8a部分V95版本升级时需要gcware.flush_statemachine强行刷快照的操作

GBase 8a部分V95版本升级时需要强行刷快照的操作

1、升级前如何确认gcware快照版本? 

  在所有gcware服务的节点上,进入$GCWARE_BASE/data/gcware目录,查看SNAPSHOT.term.index信息,如果存在多个SNAPSHOT.term.index,先比较term位置的数值,term大的为最新的快照,如果term一致,再比较index位置的数值,index大的为最新的快照。   

 2、如何刷快照?

  • (1)升级之前停止集群所有节点服务;   
  • (2)只启动所有gcware服务(V952coor上执行:gcluster_services gcware start,V953gcware上执行:gcware_services gcware start)   
  • (3)任意选择一个coor节点,执行gcadmin查看gcware服务状态,确保所有gcware服务状态均为OPEN   
  • (4)任意选择一个coor节点,执行python,import gcware,gcware.flush_statemachine(),gcware刷快照是异步执行的,返回1代表仅代表刷快照命令发送成功。   

3、如何确认快照刷成功了?

  • (1)在所有gcware服务的节点上,进入$GCWARE_BASE/data/gcware目录,查看SNAPSHOT.term.index信息,如果term或index,其中任意一个变大的SNAPSHOT.term.index文件夹存在,则代表刷新成功。   
  • (2)如果执行完gcware.flush_statemachine()后立即查看,可能会存在SNAPSHOT.term.index.s的文件夹存在,表示刷新快照正在进行中。   
  • 一般刷完了,SNAPSHOT文件会变成很小的,比如320个字节。
[gbase@gbase_rh7_001 gcware]$ python
Python 2.7.5 (default, Aug  2 2016, 04:20:16)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gcware
>>> gcware.flush_statemachine()
1
>>> gcware.flush_statemachine()
1
>>> gcware.flush_statemachine()
1
>>> gcware.flush_statemachine()
1
>>> exit()
[gbase@gbase_rh7_001 gcware]$ ll
total 16
-rw-r--r--. 1 gbase gbase  49 Dec 23 16:19 GCWARE_META.A
-rw-r--r--. 1 gbase gbase  40 Dec 23 16:19 GCWARE_META.B
-rw-r--r--. 1 gbase gbase 320 Dec 23 16:19 REDOLOG.37975
-rw-r--r--. 1 gbase gbase 320 Dec 23 16:19 REDOLOG.37977
drwxr-xr-x. 3 gbase gbase  69 Dec 23 16:19 SNAPSHOT.142.37975
drwxr-xr-x. 3 gbase gbase  69 Dec 23 16:19 SNAPSHOT.142.37977
[gbase@gbase_rh7_001 gcware]$ 

4、后续计划

为了提升易用性,降低现场误操作的风险,V95的下一版本会把上述过程自动化,由升级脚本自动完成。

操作样例

[gbase@localhost gcinstall]$ gcluster_services gcware start
Starting gcware :                                          [  OK  ]
[gbase@localhost gcinstall]$ gcadmin
CLUSTER STATE:         ACTIVE
VIRTUAL CLUSTER MODE:  NORMAL

=============================================================
|           GBASE COORDINATOR CLUSTER INFORMATION           |
=============================================================
|   NodeName   | IpAddress  | gcware | gcluster | DataState |
-------------------------------------------------------------
| coordinator1 | 10.0.2.102 | CLOSE  |  CLOSE   |     0     |
-------------------------------------------------------------
| coordinator2 | 10.0.2.202 |  OPEN  |  CLOSE   |     0     |
-------------------------------------------------------------
| coordinator3 | 10.0.2.203 | CLOSE  |  CLOSE   |     0     |
-------------------------------------------------------------
=========================================================================================================
|                                    GBASE DATA CLUSTER INFORMATION                                     |
=========================================================================================================
| NodeName |                IpAddress                 | DistributionId | gnode | syncserver | DataState |
---------------------------------------------------------------------------------------------------------
|  node1   |                10.0.2.102                |       6        | CLOSE |   CLOSE    |     0     |
---------------------------------------------------------------------------------------------------------
|  node2   |                10.0.2.202                |       6        | CLOSE |   CLOSE    |     0     |
---------------------------------------------------------------------------------------------------------
|  node3   |                10.0.2.203                |       6        | CLOSE |   CLOSE    |     0     |
---------------------------------------------------------------------------------------------------------

[gbase@localhost gcinstall]$ python
Python 2.7.5 (default, Aug  2 2016, 04:20:16)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gcware;
>>> gcware.flush_statemachine()
1
>>> quit
Use quit() or Ctrl-D (i.e. EOF) to exit
>>> quit()
[gbase@localhost gcinstall]$ gcluster_services gcware stop
Stopping gcware :                                          [  OK  ]
[gbase@localhost gcinstall]$