Gaussdb T 分布式集群升级示例

网友投稿 544 2022-05-29

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.升级前信息收集

[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]$

SQL> select * from v$version; VERSION                                                          ---------------------------------------------------------------- GaussDB_100_1.0.0.B019 Release 0b7bb43                           ZENGINE                                                          0b7bb43                                                          3 rows fetched.

[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.升级前置检查

Gaussdb T 分布式集群升级示例

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.

转自墨天轮

数据库 GaussDB

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:软件测试管理的一点小心得
下一篇:【大总结1】数据结构与传统算法总结
相关文章