当前位置: 首页 > news >正文

GBase8c主备版500升级步骤

# 升级方式区别

就地升级:升级期间需停止业务进行,一次性升级所有节点。

灰度升级:灰度升级支持全业务操作,也是一次性升级所有节点。

指定节点升级:基于灰度升级,支持升级指定节点,支持部分节点升级。

注:升级前先备份一次数据,避免升级异常导致数据丢失

方式一:就地升级

1、检查版本及状态

# 检查系统状态

[root@keep-gbase8c-primary ~]# cd /data/install_pkgb24/script
[root@keep-gbase8c-primary script]# ./gs_checkos -i A
Checking items:A1. [ OS version status ]                                   : NormalA2. [ Kernel version status ]                               : NormalA3. [ Unicode status ]                                      : NormalA4. [ Time zone status ]                                    : NormalA5. [ Swap memory status ]                                  : WarningA6. [ System control parameters status ]                    : WarningA7. [ File system configuration status ]                    : NormalA8. [ Disk configuration status ]                           : NormalA9. [ Pre-read block size status ]                          : NormalA11.[ Network card configuration status ]                   : WarningA12.[ Time consistency status ]                             : WarningA13.[ Firewall service status ]                             : NormalA14.[ THP service status ]                                  : Normal
Total numbers:13. Abnormal numbers:0. Warning numbers:4.
[root@keep-gbase8c-primary script]#

在这里插入图片描述

# 检查数据库版本和状态

# 现版本为GBase8cV5 S5.0.0B10
[gbase@keep-gbase8c-primary ~]$ gsql -V
gsql (single_node GBase8cV5 S5.0.0B10 build 933ae03f) compiled at 2023-07-01 17:04:08 commit 0 last mr 206
[gbase@keep-gbase8c-primary ~]$ gs_om -t status --detail
[  CMServer State   ]node                    node_ip         instance                              state
-------------------------------------------------------------------------------------
1  keep-gbase8c-primary 192.168.122.45  1    /data/gbase/install/cm/cm_server Primary
2  keep-gbase8c-standby 192.168.122.44  2    /data/gbase/install/cm/cm_server Standby[   Cluster State   ]cluster_state   : Normal
redistributing  : No
balanced        : Yes
current_az      : AZ_ALL[  Datanode State   ]node                    node_ip         instance                         state
------------------------------------------------------------------------------------------
1  keep-gbase8c-primary 192.168.122.45  6001 /data/gbase/install/data/dn P Primary Normal
2  keep-gbase8c-standby 192.168.122.44  6002 /data/gbase/install/data/dn S Standby Normal

在这里插入图片描述

2、上传新包,并解压
[gbase@keep-gbase8c-primary ~]$ cd /data/install_pkgb24/
[gbase@keep-gbase8c-primary install_pkgb24]$ tar -zxvf GBase8cV5_S5.0.0B24_centos7.8_x86_64.tar.gz
[gbase@keep-gbase8c-primary install_pkgb24]$ tar -zxvf GBase8cV5_S5.0.0B24_CentOS_x86_64_om.tar.gz

在这里插入图片描述

3、拷贝旧的安装模板,重新预安装

# 拷贝安装模板

[gbase@keep-gbase8c-primary install_pkgb24]$ cp /data/install_pkg/gbase.xml ./
[gbase@keep-gbase8c-primary install_pkgb24]$ more gbase.xml
<?xml version="1.0" encoding="UTF-8"?>
<ROOT><!-- 整体信息 --><CLUSTER><!-- 数据库名称 --><PARAM name="clusterName" value="GBase_8c" /><!-- 数据库节点主机名(hostname) --><PARAM name="nodeNames" value="keep-gbase8c-primary,keep-gbase8c-standby" /><!-- 数据库安装目录--><PARAM name="gaussdbAppPath" value="/data/gbase/install/app" /><!-- 日志目录--><PARAM name="gaussdbLogPath" value="/data/gbase/log/om" /><!-- 临时文件目录--><PARAM name="tmpMppdbPath" value="/data/gbase/tmp"/><!--数据库工具目录--><PARAM name="gaussdbToolPath" value="/data/gbase/install/tool" /><!--数据库core文件目录--><PARAM name="corePath" value="/data/gbase/corefile"/><!-- 节点IP,与nodeNames一一对应 --><PARAM name="backIp1s" value="192.168.122.45,192.168.122.44"/></CLUSTER><!-- 每台服务器上的节点部署信息 --><DEVICELIST><!-- 节点1上的节点部署信息,sn:主机名 --><DEVICE sn="keep-gbase8c-primary"><!-- 节点1 的主机名--><PARAM name="name" value="keep-gbase8c-primary"/><!-- 节点1 所在的AZ 及AZ优先级--><PARAM name="azName" value="AZ1"/><PARAM name="azPriority" value="1"/><!-- 如果服务器只有一个网卡可用,将backIP1和sshIP1配置成同一个IP --><PARAM name="backIp1" value="192.168.122.45"/><PARAM name="sshIp1" value="192.168.122.45"/><!-- cm主 --><PARAM name="cmsNum" value="1"/><!-- cm主: CM 安装目录 --><PARAM name="cmDir" value="/data/gbase/install/cm"/><PARAM name="cmServerPortBase" value="15300"/><PARAM name="cmServerListenIp1" value="192.168.122.45,192.168.122.44"/><PARAM name="cmServerHaIp1" value="192.168.122.45,192.168.122.44"/><!-- cmServerlevel目前只支持1 --><PARAM name="cmServerlevel" value="1"/><!-- cms主及所有备的hostname --><PARAM name="cmServerRelation" value="keep-gbase8c-primary,keep-gbase8c-standby"/><!--dn--><PARAM name="dataNum" value="1"/><PARAM name="dataPortBase" value="15400"/><PARAM name="dataNode1" value="/data/gbase/install/data/dn,keep-gbase8c-standby,/data/gbase/install/data/dn"/><PARAM name="dataNode1_syncNum" value="0"/></DEVICE><!-- node2上的节点部署信息,其中“name”的值配置为主机名 --><DEVICE sn="keep-gbase8c-standby"><!-- 节点 2 的主机名--><PARAM name="name" value="keep-gbase8c-standby"/><!-- 节点2 所在的AZ 及AZ优先级--><PARAM name="azName" value="AZ1"/><PARAM name="azPriority" value="1"/><!-- 如果服务器只有一个网卡可用,将backIP1和sshIP1配置成同一个IP --><PARAM name="backIp1" value="192.168.122.44"/><PARAM name="sshIp1" value="192.168.122.44"/><!-- cm目录 --><PARAM name="cmDir" value="/data/gbase/install/cm"/></DEVICE></DEVICELIST>
</ROOT>

在这里插入图片描述

# 执行预安装

[root@keep-gbase8c-primary install_pkgb24]# script/gs_preinstall -U gbase -G gbase -X gbase.xml

在这里插入图片描述

4、执行升级,会自动停数据库(auto-upgrade就地升级)

# 执行升级

[root@keep-gbase8c-primary install_pkgb24]# su - gbase
[gbase@keep-gbase8c-primary ~]$ cd /data/install_pkgb24/
[gbase@keep-gbase8c-primary install_pkgb24]$ gs_upgradectl -t auto-upgrade -X gbase.xml
Static configuration matched with old static configuration files.
Performing inplace rollback.
Rollback succeeded.
Checking upgrade environment.
Successfully checked upgrade environment.
Wait for the cluster status normal or degrade.
Start check CMS parameter.
Old cluster version number less than 92574.
Start to do health check.
Successfully checked cluster status.
Backing up current application and configurations.
Successfully backed up current application and configurations.
Stop cluster with gs_om successfully.
Backing up cluster configuration.
Successfully backup hotpatch config file.
Successfully backed up cluster configuration.
Installing new binary.
Restoring cluster configuration.
Successfully restored cluster configuration.
Stop cluster with gs_om successfully.
Modifying the socket path.
Successfully modified socket path.
copy certs from /data/gbase/install/app_933ae03f to /data/gbase/install/app_973db353.
Successfully copy certs from /data/gbase/install/app_933ae03f to /data/gbase/install/app_973db353.
Stop cluster with gs_om successfully.
Switch symbolic link to new binary directory.
Successfully switch symbolic link to new binary directory.
Stop cluster with gs_om successfully.
Waiting for the cluster status to become normal.
.
The cluster status is normal.
Start to do health check.
Successfully checked cluster status.
Upgrade main process has been finished, user can do some check now.
Once the check done, please execute following command to commit upgrade:gs_upgradectl -t commit-upgrade -X /data/install_pkgb24/gbase.xml

在这里插入图片描述

5、检查版本及状态

# 主节点

[gbase@keep-gbase8c-primary install_pkgb24]$ gsql -V
gsql (single_node GBase8cV5 S5.0.0B24 build 973db353) compiled at 2024-03-01 13:42:35 commit 0 last mr 484
[gbase@keep-gbase8c-primary install_pkgb24]$ gsql -p 15400 -d postgres
gsql ((single_node GBase8cV5 S5.0.0B24 build 973db353) compiled at 2024-03-01 13:42:35 commit 0 last mr 484 )
NOTICE : The password has been expired, please change the password.
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.postgres=#

在这里插入图片描述

# 备节点

[gbase@keep-gbase8c-standby ~]$ gsql -V
gsql (single_node GBase8cV5 S5.0.0B24 build 973db353) compiled at 2024-03-01 13:42:35 commit 0 last mr 484
[gbase@keep-gbase8c-standby ~]$ gsql -p 15400 -d postgres
gsql ((single_node GBase8cV5 S5.0.0B24 build 973db353) compiled at 2024-03-01 13:42:35 commit 0 last mr 484 )
NOTICE : The password has been expired, please change the password.
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.postgres=# 

在这里插入图片描述

# 检查状态

在这里插入图片描述

6、执行命令提交升级
[gbase@keep-gbase8c-primary install_pkgb24]$ gs_upgradectl -t commit-upgrade -X /data/install_pkgb24/gbase.xml
NOTICE: Start to commit binary upgrade.
Start to check whether can be committed.
Can be committed.
Start to set commit flag.
Set commit flag succeeded.
Start to do operations that cannot be rollback.
Wait for the cluster status normal or degrade.
Cancel the upgrade status succeeded.
Start to clean temp files for upgrade.
Start check CMS parameter.
Old cluster version number less than 92574.
Clean up backup catalog files.
Successfully cleaned old install path.
Stop cluster with gs_om successfully.
Clean temp files for upgrade succeeded.
NOTICE: Commit binary upgrade succeeded.

在这里插入图片描述

------------------------------------------- 分割线 -------------------------------------------

方式二:灰度升级

注:测试过程中发现先把备节点升级,后把主节点升级。

1、检查版本及状态

# 检查系统状态

[root@keep-gbase8c-primary ~]# cd /data/install_pkgb26/script/
[root@keep-gbase8c-primary script]# ./gs_checkos -i A
Checking items:A1. [ OS version status ]                                   : NormalA2. [ Kernel version status ]                               : NormalA3. [ Unicode status ]                                      : NormalA4. [ Time zone status ]                                    : NormalA5. [ Swap memory status ]                                  : WarningA6. [ System control parameters status ]                    : WarningA7. [ File system configuration status ]                    : NormalA8. [ Disk configuration status ]                           : NormalA9. [ Pre-read block size status ]                          : NormalA11.[ Network card configuration status ]                   : WarningA12.[ Time consistency status ]                             : WarningA13.[ Firewall service status ]                             : NormalA14.[ THP service status ]                                  : Normal
Total numbers:13. Abnormal numbers:0. Warning numbers:4.

在这里插入图片描述

# 检查数据库版本和状态

# 现版本为GBase8cV5 S5.0.0B24
[gbase@keep-gbase8c-primary ~]$ gsql -V
gsql (single_node GBase8cV5 S5.0.0B24 build 973db353) compiled at 2024-03-01 13:42:35 commit 0 last mr 484
[gbase@keep-gbase8c-primary ~]$ gs_om -t status --detail
[  CMServer State   ]node                    node_ip         instance                              state
-------------------------------------------------------------------------------------
1  keep-gbase8c-primary 192.168.122.45  1    /data/gbase/install/cm/cm_server Primary
2  keep-gbase8c-standby 192.168.122.44  2    /data/gbase/install/cm/cm_server Standby[   Cluster State   ]cluster_state   : Normal
redistributing  : No
balanced        : Yes
current_az      : AZ_ALL[  Datanode State   ]node                    node_ip         instance                         state
------------------------------------------------------------------------------------------
1  keep-gbase8c-primary 192.168.122.45  6001 /data/gbase/install/data/dn P Primary Normal
2  keep-gbase8c-standby 192.168.122.44  6002 /data/gbase/install/data/dn S Standby Normal

在这里插入图片描述

2、上传新包,并解压
[gbase@keep-gbase8c-primary ~]$ cd /data/install_pkgb26/
[gbase@keep-gbase8c-primary install_pkgb26]$ tar -zxvf GBase8cV5_S5.0.0B26_centos7.8_x86_64.tar.gz
[gbase@keep-gbase8c-primary install_pkgb26]$ tar -zxvf GBase8cV5_S5.0.0B26_CentOS_x86_64_om.tar.gz

在这里插入图片描述

3、拷贝旧的安装模板,重新预安装

# 拷贝安装模板

[gbase@keep-gbase8c-primary ~]$ cd /data/install_pkgb26/
[gbase@keep-gbase8c-primary install_pkgb26]$ cp /data/install_pkg/gbase.xml ./
[gbase@keep-gbase8c-primary install_pkgb26]$ cat gbase.xml
<?xml version="1.0" encoding="UTF-8"?>
<ROOT><!-- 整体信息 --><CLUSTER><!-- 数据库名称 --><PARAM name="clusterName" value="GBase_8c" /><!-- 数据库节点主机名(hostname) --><PARAM name="nodeNames" value="keep-gbase8c-primary,keep-gbase8c-standby" /><!-- 数据库安装目录--><PARAM name="gaussdbAppPath" value="/data/gbase/install/app" /><!-- 日志目录--><PARAM name="gaussdbLogPath" value="/data/gbase/log/om" /><!-- 临时文件目录--><PARAM name="tmpMppdbPath" value="/data/gbase/tmp"/><!--数据库工具目录--><PARAM name="gaussdbToolPath" value="/data/gbase/install/tool" /><!--数据库core文件目录--><PARAM name="corePath" value="/data/gbase/corefile"/><!-- 节点IP,与nodeNames一一对应 --><PARAM name="backIp1s" value="192.168.122.45,192.168.122.44"/></CLUSTER><!-- 每台服务器上的节点部署信息 --><DEVICELIST><!-- 节点1上的节点部署信息,sn:主机名 --><DEVICE sn="keep-gbase8c-primary"><!-- 节点1 的主机名--><PARAM name="name" value="keep-gbase8c-primary"/><!-- 节点1 所在的AZ 及AZ优先级--><PARAM name="azName" value="AZ1"/><PARAM name="azPriority" value="1"/><!-- 如果服务器只有一个网卡可用,将backIP1和sshIP1配置成同一个IP --><PARAM name="backIp1" value="192.168.122.45"/><PARAM name="sshIp1" value="192.168.122.45"/><!-- cm主 --><PARAM name="cmsNum" value="1"/><!-- cm主: CM 安装目录 --><PARAM name="cmDir" value="/data/gbase/install/cm"/><PARAM name="cmServerPortBase" value="15300"/><PARAM name="cmServerListenIp1" value="192.168.122.45,192.168.122.44"/><PARAM name="cmServerHaIp1" value="192.168.122.45,192.168.122.44"/><!-- cmServerlevel目前只支持1 --><PARAM name="cmServerlevel" value="1"/><!-- cms主及所有备的hostname --><PARAM name="cmServerRelation" value="keep-gbase8c-primary,keep-gbase8c-standby"/><!--dn--><PARAM name="dataNum" value="1"/><PARAM name="dataPortBase" value="15400"/><PARAM name="dataNode1" value="/data/gbase/install/data/dn,keep-gbase8c-standby,/data/gbase/install/data/dn"/><PARAM name="dataNode1_syncNum" value="0"/></DEVICE><!-- node2上的节点部署信息,其中“name”的值配置为主机名 --><DEVICE sn="keep-gbase8c-standby"><!-- 节点 2 的主机名--><PARAM name="name" value="keep-gbase8c-standby"/><!-- 节点2 所在的AZ 及AZ优先级--><PARAM name="azName" value="AZ1"/><PARAM name="azPriority" value="1"/><!-- 如果服务器只有一个网卡可用,将backIP1和sshIP1配置成同一个IP --><PARAM name="backIp1" value="192.168.122.44"/><PARAM name="sshIp1" value="192.168.122.44"/><!-- cm目录 --><PARAM name="cmDir" value="/data/gbase/install/cm"/></DEVICE></DEVICELIST>
</ROOT>

在这里插入图片描述

# 执行预安装

[root@keep-gbase8c-primary install_pkgb26]# script/gs_preinstall -U gbase -G gbase -X gbase.xml

在这里插入图片描述

4、执行灰度升级

# 执行升级

[root@keep-gbase8c-primary install_pkgb26]# su - gbase
[gbase@keep-gbase8c-primary ~]$ cd /data/install_pkgb26/
[gbase@keep-gbase8c-primary install_pkgb26]$ gs_upgradectl -t auto-upgrade -X gbase.xml --grey# 如果想监控集群状态,可以重起一个终端,循环执行以下命令
# 检查数据库版本
gs_ssh -c "gsql -p 15400 -d postgres -c 'select version()'"
# 检查数据库状态
gs_om -t status --detail

在这里插入图片描述

5、检查版本及状态

# 主节点

[gbase@keep-gbase8c-primary ~]$ gsql -V
gsql (single_node GBase8cV5 S5.0.0B26 build aedab09d) compiled at 2024-04-16 15:03:11 commit 0 last mr 532
[gbase@keep-gbase8c-primary ~]$ gsql -p 15400 -d postgres
gsql ((single_node GBase8cV5 S5.0.0B26 build aedab09d) compiled at 2024-04-16 15:03:11 commit 0 last mr 532 )
NOTICE : The password has been expired, please change the password.
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.postgres=#

在这里插入图片描述

# 备节点

[gbase@keep-gbase8c-standby ~]$ gsql -V
gsql (single_node GBase8cV5 S5.0.0B26 build aedab09d) compiled at 2024-04-16 15:03:11 commit 0 last mr 532
[gbase@keep-gbase8c-standby ~]$ gsql -p 15400 -d postgres
gsql ((single_node GBase8cV5 S5.0.0B26 build aedab09d) compiled at 2024-04-16 15:03:11 commit 0 last mr 532 )
NOTICE : The password has been expired, please change the password.
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.postgres=# 

在这里插入图片描述

# 检查状态

在这里插入图片描述

6、执行命令提交升级
[gbase@keep-gbase8c-primary install_pkgb26]$ gs_upgradectl -t commit-upgrade -X /data/install_pkgb26/gbase.xml
Wait for the cluster status normal or degrade.
Start check CMS parameter.
Old cluster version number less than 92574.
Start to do health check.
Successfully checked cluster status.
Start check CMS parameter.
Old cluster version number less than 92574.
Successfully cleaned old install path.
Commit upgrade succeeded.
Start check CMS parameter.
Old cluster version number less than 92574.

在这里插入图片描述

------------------------------------------- 分割线 -------------------------------------------

方式三:指定节点升级

----------待更新


http://www.mrgr.cn/news/29479.html

相关文章:

  • 卫导调零天线功率倒置算法原理及MATLAB仿真
  • Linux中.NET读取excel组件,不会出现The type initializer for ‘Gdip‘ threw an exception异常
  • 《Redis集群高可用环境构建与优化》
  • C#版使用融合通信API发送手机短信息
  • Jmeter中的定时器(二)
  • Rust学习(二):rust基础语法Ⅰ
  • 电磁场与电磁波 1.1矢量基础知识
  • 笔记:简介Drawing是什么,都有哪些,如何使用
  • 开放式激光振镜运动控制器在Ubuntu+Qt下CAD图形标刻
  • 极光参展2024年服贸会并荣获“年度出海领航企业”荣誉
  • AI解锁生命密码:AlphaFold绘制病毒“家谱”,揭秘进化奇缘
  • 按关键字搜索商品 API,实现商品数据透明化.
  • 为您的任意模型赋能——RAG
  • MySQL之复合查询与内外连接
  • 个人信息安全“硬核”守护:企业引领方向,个人贡献力量,共筑安全防火墙
  • 执着追求与匠心独运 朵拉朵尚2024欧洲溯源 深入德国巴斯夫
  • CodeMeter 8.20AxProtector 11.50版本更新
  • 【论文阅读】3D Diffuser Actor: Policy Diffusion with 3D Scene Representations
  • 如何学懂C++语言:C++从入门到精通的全面指南(完整C++学习笔记)
  • 足底筋膜炎贴什么膏药
  • RFID技术实现消防物资消防车无感化智能管理设计方案
  • 关于几种msvcr100.dll丢失的解决方法,详细介绍msvcr100.dll文件
  • 【BurpSuite】Cross-site scripting (XSS 学徒部分:1-9)
  • 智能码二维码在化妆品防伪中的应用
  • UE4_后期处理七—仿红外线成像效果
  • 钢铁焦化水泥超低排放实施方案