Gaussdb T 分布式集群升级示例

举报
社会主义的一块砖 发表于 2020/02/12 16:33:25 2020/02/12
【摘要】 Gaussdb T分布式集群可通过gs_upgradectl对数据库进行离线版本升级,本文演示将数据库从GaussDB_100_1.0.0.B019 Release 0b7bb43升级至GaussDB_100_1.0.1.SPC2.B003 Release 3ae9d6c的整个过程。1.gs_upgradectl命令帮助[omm@gaussdb1 script]$ which gs_upgr...

Gaussdb T分布式集群可通过gs_upgradectl对数据库进行离线版本升级,本文演示将数据库从GaussDB_100_1.0.0.B019 Release 0b7bb43升级至GaussDB_100_1.0.1.SPC2.B003 Release 3ae9d6c的整个过程。

1.gs_upgradectl命令帮助

[omm@gaussdb1 script]$ which gs_upgradectl
/gaussdb/gaussTools/wisequery/script/gs_upgradectl
[omm@gaussdb1 script]$ gs_upgradectl  --help

gs_upgradectl is a utility to upgrade a cluster.

Usage:
  gs_upgradectl -? | --help
  gs_upgradectl -V | --version

  gs_upgradectl -t upgrade-type -X XMLFILE [-l LOGFILE]
  gs_upgradectl -t offline-upgrade -X XMLFILE [-l LOGFILE]
  gs_upgradectl -t offline-rollback -X XMLFILE [-l LOGFILE]

General options:
  -?, --help                      Show help information for this utility, and exit the command line mode.
  -V, --version                   Show version information.
  -t                              Subcommand for upgrade. It can be upgrade-type,
                                  offline-upgrade, offline-rollback.
  -X                              Path of the XML configuration file of the later version cluster.
  -l                              Path of log file.

        
[omm@gaussdb1 script]$

参数解释:

-X 集群配置文件
-l 日志文件
-t 升级类型,其中upgrade-type为判断本次升级类型,systable-upgrade为离线小版本升级,binary-upgrade为离线二进制升级。

2.升级前信息收集

a).集群状态

[omm@gaussdb1 script]$ gs_om -t status
Set output to terminal.
--------------------------------------------------------------------Cluster Status--------------------------------------------------------------------
az_state :      single_az
cluster_state : Normal
balanced :      true
----------------------------------------------------------------------AZ Status-----------------------------------------------------------------------
AZ:AZ1                ROLE:primary            STATUS:ONLINE      
---------------------------------------------------------------------Host Status----------------------------------------------------------------------
HOST:gaussdb1         AZ:AZ1                  STATUS:ONLINE       IP:10.111.76.22
HOST:gaussdb2         AZ:AZ1                  STATUS:ONLINE       IP:10.111.76.23
HOST:gaussdb3         AZ:AZ1                  STATUS:ONLINE       IP:10.111.76.24
HOST:gaussdb4         AZ:AZ1                  STATUS:ONLINE       IP:10.111.76.25
----------------------------------------------------------------Cluster Manager Status----------------------------------------------------------------
INSTANCE:CM1          ROLE:primary            STATUS:ONLINE       HOST:gaussdb1         ID:601
INSTANCE:CM2          ROLE:slave              STATUS:ONLINE       HOST:gaussdb2         ID:602
---------------------------------------------------------------------ETCD Status----------------------------------------------------------------------
INSTANCE:ETCD1        ROLE:follower           STATUS:ONLINE       HOST:gaussdb1         ID:701      PORT:2379         DataDir:/gaussdb/data/etcd/data_etcd1
INSTANCE:ETCD2        ROLE:leader             STATUS:ONLINE       HOST:gaussdb2         ID:702      PORT:2379         DataDir:/gaussdb/data/etcd/data_etcd1
INSTANCE:ETCD3        ROLE:follower           STATUS:ONLINE       HOST:gaussdb3         ID:703      PORT:2379         DataDir:/gaussdb/data/etcd/data_etcd1
----------------------------------------------------------------------CN Status-----------------------------------------------------------------------
INSTANCE:cn_401       ROLE:no role            STATUS:ONLINE       HOST:gaussdb1         ID:401      PORT:8000         DataDir:/gaussdb/data/cn
INSTANCE:cn_402       ROLE:no role            STATUS:ONLINE       HOST:gaussdb2         ID:402      PORT:8000         DataDir:/gaussdb/data/cn
INSTANCE:cn_403       ROLE:no role            STATUS:ONLINE       HOST:gaussdb3         ID:403      PORT:8000         DataDir:/gaussdb/data/cn
INSTANCE:cn_404       ROLE:no role            STATUS:ONLINE       HOST:gaussdb4         ID:404      PORT:8000         DataDir:/gaussdb/data/cn
---------------------------------------------------------Instances Status in Group (group_1)----------------------------------------------------------
INSTANCE:DB1_1        ROLE:primary            STATUS:ONLINE       HOST:gaussdb1         ID:1        PORT:4000         DataDir:/gaussdb/data/dn1
INSTANCE:DB1_2        ROLE:standby            STATUS:ONLINE       HOST:gaussdb2         ID:2        PORT:4000         DataDir:/gaussdb/data/dn1
---------------------------------------------------------Instances Status in Group (group_2)----------------------------------------------------------
INSTANCE:DB2_3        ROLE:primary            STATUS:ONLINE       HOST:gaussdb3         ID:3        PORT:4000         DataDir:/gaussdb/data/dn3
INSTANCE:DB2_4        ROLE:standby            STATUS:ONLINE       HOST:gaussdb4         ID:4        PORT:4000         DataDir:/gaussdb/data/dn3
--------------------------------------------------Manage IP--------------------------------------------------
HOST:gaussdb1         IP:10.111.76.22
HOST:gaussdb2         IP:10.111.76.23
HOST:gaussdb3         IP:10.111.76.24
HOST:gaussdb4         IP:10.111.76.25
[omm@gaussdb1 script]$

b).版本信息

SQL> select * from v$version;

VERSION                                                         
----------------------------------------------------------------
GaussDB_100_1.0.0.B019 Release 0b7bb43                          
ZENGINE                                                         
0b7bb43                                                         

3 rows fetched.

c).数据同步情况

[omm@gaussdb1 script]$ zsql / as sysdba 10.111.76.22:4000 -D /gaussdb/data/dn1

Warning: SSL connection to server without CA certificate is insecure. Continue anyway? (y/n):y
connected.


SQL> SELECT LOCAL_LFN, PEER_LFN FROM DV_HA_SYNC_INFO; 

LOCAL_LFN            PEER_LFN            
-------------------- --------------------
1646                 1646                

1 rows fetched.

SQL> 


[omm@gaussdb3 ~]$ zsql / as sysdba 10.111.76.24:4000 -D /gaussdb/data/dn3 -q

connected.


SQL> SELECT LOCAL_LFN, PEER_LFN FROM DV_HA_SYNC_INFO; 

LOCAL_LFN            PEER_LFN            
-------------------- --------------------
1631                 1631                

1 rows fetched.

SQL>

3.新版本介质准备

[root@gaussdb1 script]# mkdir -p /opt/software/upgrade
[root@gaussdb1 upgrade]# tar -zxvf ../1.0.1/GaussDB_100_1.0.1-CLUSTER-REDHAT7.5-64bit.tar.gz

[root@gaussdb1 upgrade]# ls -lrt
total 54476
drwx------ 6 omm dbgrp     4096 Dec 14 11:40 script
drwx------ 7 omm dbgrp      196 Dec 14 11:40 lib
-rwx------ 1 omm dbgrp  8038086 Dec 14 11:43 GaussDB_100_1.0.1-DATABASE-REDHAT-64bit.tar.gz
-rwx------ 1 omm dbgrp   128240 Dec 14 11:46 GaussDB_100_1.0.1-ROACH-REDHAT-64bit.tar.gz
-rwx------ 1 omm dbgrp 47604191 Dec 14 11:46 GaussDB_100_1.0.1-CM-REDHAT-64bit.tar.gz
drwx------ 5 omm dbgrp       49 Dec 14 11:46 shardingscript
[root@gaussdb1 script]# cp /opt/soft/GaussDB_100-Upgrade-WhiteList.txt /gaussdb/gaussTools/wisequery
[root@gaussdb1 script]#

4.升级前检查磁盘空间

Gaussdb T升级前会对数据库进行备份,请确保空闲空间足够。

[omm@gaussdb1 script]$  df -lh /gaussdb
Filesystem                   Size  Used Avail Use% Mounted on
/dev/mapper/vg_data-lv_data  150G   42G  109G  28% /gaussdb
[omm@gaussdb1 script]$ 
[omm@gaussdb2 ~]$  df -lh /gaussdb
Filesystem                   Size  Used Avail Use% Mounted on
/dev/mapper/vg_data-lv_data  150G   42G  109G  28% /gaussdb
[omm@gaussdb2 ~]$ 
[omm@gaussdb3 ~]$  df -lh /gaussdb
Filesystem                   Size  Used Avail Use% Mounted on
/dev/mapper/vg_data-lv_data  150G   42G  109G  28% /gaussdb
[omm@gaussdb3 ~]$
[omm@gaussdb4 ~]$ df -lh /gaussdb/
Filesystem                   Size  Used Avail Use% Mounted on
/dev/mapper/vg_data-lv_data  150G   42G  109G  28% /gaussdb
[omm@gaussdb4 ~]$

5.升级前置检查

cd /opt/software/upgrade/script
./gs_preinstall -U omm -G dbgrp  -X /opt/clusterconfig.xml  --alarm-type=1 --operation=upgrade

检查日志

[root@gaussdb1 script]# ./gs_preinstall -U omm -G dbgrp  -X /opt/clusterconfig.xml  --alarm-type=1 --operation=upgrade
Parsing the configuration file.
Successfully parsed the configuration file.
Do preinstall for upgrade.
Check environment for upgrade preinstall.
Successfully check environment for upgrade preinstall.
Installing the tools on the local node.
Successfully installed the tools on the local node.
Distributing package.
Successfully distributed package.
Check old environment on all nodes.
Successfully check old environment on all nodes.
Installing the tools in the cluster.
Successfully installed the tools in the cluster.
Fixing server package owner.
Successfully fixed server package owner.
Preinstallation succeeded.

6.检查升级类型

systable-upgrade为离线小版本升级,binary-upgrade为离线二进制升级。本次升级为离线小版本升级。

[omm@gaussdb1 script]$ gs_upgradectl -t upgrade-type -X /opt/clusterconfig.xml
Checking upgrade type.
Successfully checked upgrade type.
Upgrade type: systable-upgrade.
[omm@gaussdb1 script]$

7.正式升级

升级命令

gs_upgradectl -t offline-upgrade -X /opt/clusterconfig.xml

升级日志

[omm@gaussdb1 script]$ gs_upgradectl -t offline-upgrade -X /opt/clusterconfig.xml
Performing systable-upgrade.
Checking cluster health.
Successfully checked cluster health.
Checking database status.
Successfully checked database status.
Checking space for backup files.
Successfully checked space for backup files.
Change the primary dn and cn to read only status.
Successfully changed the primary dn and cn to read only status.
Checking database read only status.
Successfully checked database read only status.
Checking sync info for dns.
Successfully checking sync info for dns.
Generating upgrade sql file.
Successfully generated upgrade sql file.
Generating combined upgrade sql file.
Successfully generated combined upgrade sql file.
Backing up current application and configurations.
Successfully backed up current application and configurations.
Saving system tabls path.
Successfully saved system tables path.
Saving redo log file path.
Successfully saved redolog file path.
Saving undo log file path.
Successfully saved redolog file path.
Stopping the cluster.
Successfully stopped the cluster.
Stopping the etcd and agent.
Successfully stopped the etcd and agent.
Starting all dns to open status for backuping system cntl and redolog.
Successfully started all dns to open status for backuping system cntl and redolog.
Backing up current system tables.
Successfully backed up system tables.
Backing up current cntl files.
Successfully backed up cntl files.
Backing up current redolog files.
Successfully backed up redolog files.
Backing up current undolog files.
Successfully backed up undolog files.
Shutdowning all dns for backuping system cntl and redolog.
Successfully shutdown all dns for backuping system cntl and redolog.
Upgrading application.
Successfully upgraded application.
Starting the restrict mode cluster.
Successfully started the restrict mode cluster.
Upgrading the system table
Successfully upgraded the system table
Shutting down the restrict mode cluster
Successfully shut down the restrict mode cluster
Starting the cns, dns to open status.
Successfully started the cns, dns to open status.
Converting the cns, primary dns to read write status.
Successfully converted the cns, primary dns to read write status.
Shutting down the open status cns, dns.
Successfully shutted down the open status cns, dns.
Starting the etcd.
Successfully started the etcd.
Loading the json.
Successfully loaded the json.
Starting cm agent.
Successfully started cm agent.
Starting the cluster.
Successfully started the cluster.
Commit systable-upgrade succeeded.
Time for "UpgradeCheck" : 29.9917 seconds
Time for "UpgradeBackup" : 23.663 seconds
Time for "UpgradeStopCluster" : 25.9406 seconds
Time for "UpgradeBackupSysCntlRedo" : 1125.6257 seconds
Time for "Upgrade" : 9.7374 seconds
Time for "KernelUpgrade" : 135.4509 seconds
Time for "ShutdownRestrict" : 15.1444 seconds
Time for "StartOpen" : 20.6434 seconds
Time for "ConvertReadWrite" : 15.1271 seconds
Time for "ShutdownOpen" : 10.156 seconds
Time for "SystemTable" : 310.5378 seconds
Time for "UpgradeStartCluster" : 45.6341 seconds
Time for "Total" : 1614.5994 seconds
[omm@gaussdb1 script]$

8.升级成功后验证

集群状态

[omm@gaussdb1 script]$ gs_om -t status
Set output to terminal.
--------------------------------------------------------------------Cluster Status--------------------------------------------------------------------
az_state :      single_az
cluster_state : Normal
balanced :      true
----------------------------------------------------------------------AZ Status-----------------------------------------------------------------------
AZ:AZ1                ROLE:primary            STATUS:ONLINE      
---------------------------------------------------------------------Host Status----------------------------------------------------------------------
HOST:gaussdb1         AZ:AZ1                  STATUS:ONLINE       IP:10.111.76.22
HOST:gaussdb2         AZ:AZ1                  STATUS:ONLINE       IP:10.111.76.23
HOST:gaussdb3         AZ:AZ1                  STATUS:ONLINE       IP:10.111.76.24
HOST:gaussdb4         AZ:AZ1                  STATUS:ONLINE       IP:10.111.76.25
----------------------------------------------------------------Cluster Manager Status----------------------------------------------------------------
INSTANCE:CM1          ROLE:primary            STATUS:ONLINE       HOST:gaussdb1         ID:601
INSTANCE:CM2          ROLE:slave              STATUS:ONLINE       HOST:gaussdb2         ID:602
---------------------------------------------------------------------ETCD Status----------------------------------------------------------------------
INSTANCE:ETCD1        ROLE:follower           STATUS:ONLINE       HOST:gaussdb1         ID:701      PORT:2379         DataDir:/gaussdb/data/etcd/data_etcd1
INSTANCE:ETCD2        ROLE:leader             STATUS:ONLINE       HOST:gaussdb2         ID:702      PORT:2379         DataDir:/gaussdb/data/etcd/data_etcd1
INSTANCE:ETCD3        ROLE:follower           STATUS:ONLINE       HOST:gaussdb3         ID:703      PORT:2379         DataDir:/gaussdb/data/etcd/data_etcd1
----------------------------------------------------------------------CN Status-----------------------------------------------------------------------
INSTANCE:cn_401       ROLE:no role            STATUS:ONLINE       HOST:gaussdb1         ID:401      PORT:8000         DataDir:/gaussdb/data/cn
INSTANCE:cn_402       ROLE:no role            STATUS:ONLINE       HOST:gaussdb2         ID:402      PORT:8000         DataDir:/gaussdb/data/cn
INSTANCE:cn_403       ROLE:no role            STATUS:ONLINE       HOST:gaussdb3         ID:403      PORT:8000         DataDir:/gaussdb/data/cn
INSTANCE:cn_404       ROLE:no role            STATUS:ONLINE       HOST:gaussdb4         ID:404      PORT:8000         DataDir:/gaussdb/data/cn
---------------------------------------------------------Instances Status in Group (group_1)----------------------------------------------------------
INSTANCE:DB1_1        ROLE:primary            STATUS:ONLINE       HOST:gaussdb1         ID:1        PORT:4000         DataDir:/gaussdb/data/dn1
INSTANCE:DB1_2        ROLE:standby            STATUS:ONLINE       HOST:gaussdb2         ID:2        PORT:4000         DataDir:/gaussdb/data/dn1
---------------------------------------------------------Instances Status in Group (group_2)----------------------------------------------------------
INSTANCE:DB2_3        ROLE:primary            STATUS:ONLINE       HOST:gaussdb3         ID:3        PORT:4000         DataDir:/gaussdb/data/dn3
INSTANCE:DB2_4        ROLE:standby            STATUS:ONLINE       HOST:gaussdb4         ID:4        PORT:4000         DataDir:/gaussdb/data/dn3
-----------------------------------------------------------------------Manage IP----------------------------------------------------------------------
HOST:gaussdb1         IP:10.111.76.22
HOST:gaussdb2         IP:10.111.76.23
HOST:gaussdb3         IP:10.111.76.24
HOST:gaussdb4         IP:10.111.76.25
-------------------------------------------------------------------Query Action Info------------------------------------------------------------------
HOSTNAME: gaussdb1     TIME: 2020-02-06 12:04:50.821710
------------------------------------------------------------------------Float Ip------------------------------------------------------------------
HOST:gaussdb3    DB2_3:10.111.76.24    IP:
HOST:gaussdb1    DB1_1:10.111.76.22    IP:
[omm@gaussdb1 script]$

版本信息

SQL> select * from v$version;

VERSION                                                         
----------------------------------------------------------------
GaussDB_100_1.0.1.SPC2.B003 Release 3ae9d6c                     
ZENGINE                                                         
3ae9d6c                                                         

3 rows fetched.

SQL>

至此,成功将Gaussdb T从1.0.0升级至1.0.1.


转自墨天轮

【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。