暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

openGauss 企业版 2.0.0 升级至 2.0.1 记录

原创 shlei6067 2022-11-03
782

一、准备工作

1.1 下载2.0.1 软件包

-- 移动 /opt/software/openGauss 除 clusterconfig.xml文件外文件及路至备份处
-- 下载 2.0.1 软件包至节点一 /opt/software/openGauss目录
[root@opengauss-node1 openGauss]# ll
total 99160
drwxr-xr-x 5 root root       4096 Nov  3 10:37 bak
-rw------- 1 omm  dbgrp      2055 Nov  1 17:32 clusterconfig.xml
-rw-r--r-- 1 root root  101525905 Nov  3 10:33 openGauss-2.0.1-CentOS-64bit-all.tar.gz
复制

1.2 解压2.0.1 软件包

-- root用户节点一操作
[root@opengauss-node1 openGauss]# tar -zxvf openGauss-2.0.1-CentOS-64bit-all.tar.gz 
[root@opengauss-node1 openGauss]# tar -zxvf openGauss-2.0.1-CentOS-64bit-om.tar.gz
复制

1.3 查看当前版本

-- omm用户
[root@opengauss-node1 openGauss]# su - omm
Last login: Wed Nov  2 13:47:54 CST 2022 on pts/3
[omm@opengauss-node1 ~]$ gs_om -V
gs_om (openGauss OM 2.0.0 build 7ef5c80a) compiled at 2021-03-31 21:16:06 commit 0 last mr
复制

1.4 查看集群状态

[omm@opengauss-node1 ~]$ gs_om -t status --detail --all
[   Cluster State   ]

cluster_state   : Normal
redistributing  : No
current_az      : AZ_ALL

[  Datanode State   ]

node               node_ip         instance                  state            | node               node_ip         instance                  state
--------------------------------------------------------------------------------------------------------
1  opengauss-node1 192.168.17.136  6001 /gaussdb/data/db1 P Primary Normal | 2  opengauss-node2 192.168.17.137  6002 /gaussdb/data/db1 S Standby Normal
复制

image20221103105331027.png

1.5 停止集群

-- 停集群,节点一 omm用户
[omm@opengauss-node1 ~]$ gs_om -t stop
Stopping cluster.
=========================================
Successfully stopped cluster.
=========================================
End stop cluster.
[omm@opengauss-node1 ~]$ 

-- 查看集群状态
[omm@opengauss-node1 ~]$ gs_om -t status --detail --all
[   Cluster State   ]

cluster_state   : Unavailable
redistributing  : No
current_az      : AZ_ALL

[  Datanode State   ]

node               node_ip         instance                  state            | node               node_ip         instance                  state
------------------------------------------------------------------------------------------------------------------------------------------------------------------
1  opengauss-node1 192.168.17.136  6001 /gaussdb/data/db1 P Down    Manually stopped | 2  opengauss-node2 192.168.17.137  6002 /gaussdb/data/db1 S Down    Manually stopped
复制

image20221103105524353.png

1.6 备份目录及文件

-- 升级前建议参照clusterconfig.xml文件对相应目录及文件进行备份,以防升级失败
复制

1.7 启动集群

[omm@opengauss-node1 gs_guc]$ gs_om -t start
Starting cluster.
=========================================
[SUCCESS] opengauss-node1
2022-11-03 11:43:11.561 636338ce.1 [unknown] 139989721929472 [unknown] 0 dn_6001_6002 01000  0 [BACKEND] WARNING:  Failed to initialize the memory protect for g_instance.attr.attr_storage.cstore_buffers (1024 Mbytes) or shared memory (4250 Mbytes) is larger.
[SUCCESS] opengauss-node2
2022-11-03 11:43:18.248 636338d5.1 [unknown] 140390653990656 [unknown] 0 dn_6001_6002 01000  0 [BACKEND] WARNING:  Failed to initialize the memory protect for g_instance.attr.attr_storage.cstore_buffers (1024 Mbytes) or shared memory (4250 Mbytes) is larger.
=========================================
Successfully started.
[omm@opengauss-node1 gs_guc]$ gs_om -t status --detail --all
[   Cluster State   ]

cluster_state   : Normal
redistributing  : No
current_az      : AZ_ALL

[  Datanode State   ]

node               node_ip         instance                  state            | node               node_ip         instance                  state
--------------------------------------------------------------------------------------------------------
1  opengauss-node1 192.168.17.136  6001 /gaussdb/data/db1 P Primary Normal | 2  opengauss-node2 192.168.17.137  6002 /gaussdb/data/db1 S Standby Normal
复制

image20221103131140063.png

二、集群升级

2.1 升级前预检查

-- root用户,节点一操作
-- 设置lib库
[root@opengauss-node1 ~]# export LD_LIBRARY_PATH=/opt/software/openGauss/script/gspylib/clib:$LD_LIBRARY_PATH

-- 执行预检查
[root@opengauss-node1 ~]# python3 /opt/software/openGauss/script/gs_preinstall -U omm -G dbgrp -X /opt/software/openGauss/clusterconfig.xml

-- 以下是预检查执行过程
Parsing the configuration file.
Successfully parsed the configuration file.
Installing the tools on the local node.
Successfully installed the tools on the local node.
Are you sure you want to create trust for root (yes/no)? yes -- 输入yes
Please enter password for root.
Password: 
Creating SSH trust for the root permission user.
Checking network information.
All nodes in the network are Normal.
Successfully checked network information.
Creating SSH trust.
Creating the local key file.
Successfully created the local key files.
Appending local ID to authorized_keys.
Successfully appended local ID to authorized_keys.
Updating the known_hosts file.
Successfully updated the known_hosts file.
Appending authorized_key on the remote node.
Successfully appended authorized_key on all remote node.
Checking common authentication file content.
Successfully checked common authentication content.
Distributing SSH trust file to all node.
Successfully distributed SSH trust file to all node.
Verifying SSH trust on all hosts.
Successfully verified SSH trust on all hosts.
Successfully created SSH trust.
Successfully created SSH trust for the root permission user.
Setting pssh path
Successfully set core path.
Distributing package.
Begin to distribute package to tool path.
Successfully distribute package to tool path.
Begin to distribute package to package path.
Successfully distribute package to package path.
Successfully distributed package.
Are you sure you want to create the user[omm] and create trust for it (yes/no)? no --输入no
Preparing SSH service.
Successfully prepared SSH service.
Installing the tools in the cluster.
Successfully installed the tools in the cluster.
Checking hostname mapping.
Successfully checked hostname mapping.
Checking OS software.
Successfully check os software.
Checking OS version.
Successfully checked OS version.
Creating cluster's path.
Successfully created cluster's path.
Setting SCTP service.
Successfully set SCTP service.
Set and check OS parameter.
Setting OS parameters.
Successfully set OS parameters.
Warning: Installation environment contains some warning messages.
Please get more details by "/opt/software/openGauss/script/gs_checkos -i A -h opengauss-node1,opengauss-node2 --detail".
Set and check OS parameter completed.
Preparing CRON service.
Successfully prepared CRON service.
Setting user environmental variables.
Successfully set user environmental variables.
Setting the dynamic link library.
Successfully set the dynamic link library.
Setting Core file
Successfully set core path.
Setting pssh path
Successfully set pssh path.
Set ARM Optimization.
No need to set ARM Optimization.
Fixing server package owner.
Setting finish flag.
Successfully set finish flag.
Preinstallation succeeded.

-- 查看预检查执行详细信息,可执行如下命令,另外也可以进入到/opt/gaussdb/log/omm/om目录下查看执行过程日志
[root@opengauss-node1 ~]# /opt/software/openGauss/script/gs_checkos -i A -h opengauss-node1,opengauss-node2 --detail
-- 执行结果如下
Checking items:
    A1. [ OS version status ]                                   : Normal     
        [opengauss-node2]
        centos_7.6.1810_64bit
        [opengauss-node1]
        centos_7.6.1810_64bit

    A2. [ Kernel version status ]                               : Normal     
        The names about all kernel versions are same. The value is "3.10.0-957.27.2.el7.x86_64".
    A3. [ Unicode status ]                                      : Normal     
        The values of all unicode are same. The value is "LANG=en_US.UTF-8".
    A4. [ Time zone status ]                                    : Normal     
        The informations about all timezones are same. The value is "+0800".
    A5. [ Swap memory status ]                                  : Normal     
        The value about swap memory is correct.            
    A6. [ System control parameters status ]                    : Normal     
        All values about system control  parameters are correct.
    A7. [ File system configuration status ]                    : Normal     
        Both soft nofile and hard nofile are correct.      
    A8. [ Disk configuration status ]                           : Normal     
        The value about XFS mount parameters is correct.   
    A9. [ Pre-read block size status ]                          : Normal     
        The value about Logical block size is correct.     
    A10.[ IO scheduler status ]                                 : Normal     
        The value of IO scheduler is correct.              
    A11.[ Network card configuration status ]                   : Warning    
        [opengauss-node2]
BondMode Null
        Warning reason: network 'ens33' 'mtu' RealValue '1500' ExpectedValue '8192'

        [opengauss-node1]
BondMode Null
        Warning reason: network 'ens33' 'mtu' RealValue '1500' ExpectedValue '8192'


    A12.[ Time consistency status ]                             : Warning    
        [opengauss-node2]
        The NTPD not detected on machine and local time is "2022-11-03 11:08:31".
        [opengauss-node1]
        The NTPD not detected on machine and local time is "2022-11-03 11:08:31".

    A13.[ Firewall service status ]                             : Normal     
        The firewall service is stopped.                   
    A14.[ THP service status ]                                  : Normal     
        The THP service is stopped.                        
Total numbers:14. Abnormal numbers:0. Warning numbers:2.
复制

image20221103111034608.png

-- omm用户
# 预检查执行后会发现数据库版本其实已经发生了改变
[root@opengauss-node1 ~]# su - omm
Last login: Thu Nov  3 11:12:03 CST 2022 on pts/1
[omm@opengauss-node1 ~]$ gs_om -V
gs_om (openGauss OM 2.0.1 build da8e0828) compiled at 2021-06-02 19:48:22 commit 0 last mr
复制

image20221103111359171.png

2.2 执行升级


[root@opengauss-node1 ~]# chmod -R 755 /opt/software/openGauss/script/
[root@opengauss-node1 ~]# chown -R omm:dbgrp /opt/software/openGauss/script/
[root@opengauss-node1 ~]# su - omm
Last login: Thu Nov  3 11:13:42 CST 2022 on pts/1

-- 灰度升级
[omm@opengauss-node1 ~]$ /opt/software/openGauss/script/gs_upgradectl -t auto-upgrade --grey -X /opt/software/openGauss/clusterconfig.xml

-- 执行过程如下
Static configuration matched with old static configuration files.
Successfully set upgrade_mode to 0.
Checking upgrade environment.
Successfully checked upgrade environment.
Start to do health check.
Successfully checked cluster status.
Upgrade all nodes.
Performing grey rollback.
No need to rollback.
The directory /opt/gaussdb/app_78689da9 will be deleted after commit-upgrade, please make sure there is no personal data.
Installing new binary.
Successfully backup hotpatch config file.
Sync cluster configuration.
Successfully synced cluster configuration.
Switch symbolic link to new binary directory.
Successfully switch symbolic link to new binary directory.
Switching all db processes.
Wait for the cluster status normal or degrade.
Successfully switch all process version
The nodes ['opengauss-node1', 'opengauss-node2'] have been successfully upgraded to new version. Then do health check.
Start to do health check.
Successfully checked cluster status.
Waiting for the cluster status to become normal.
.
The cluster status is normal.
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 /opt/software/openGauss/clusterconfig.xml   

Successfully upgrade nodes.

-- 升级提交
[omm@opengauss-node1 ~]$ gs_upgradectl -t commit-upgrade -X /opt/software/openGauss/clusterconfig.xml
Start to do health check.
Successfully checked cluster status.
Successfully cleaned old install path.
Commit upgrade succeeded.

# 在执行升级时如遇到权限报错,请参照 三、补充部分 3.2 部分处理过程
复制

image20221103123104000.png

2.3 信息检查

-- 查看版本信息
[root@opengauss-node1 script]# su - omm
Last login: Thu Nov  3 13:21:48 CST 2022 on pts/2
[omm@opengauss-node1 ~]$ gs_om -V
gs_om (openGauss OM 2.0.1 build da8e0828) compiled at 2021-06-02 19:48:22 commit 0 last mr

-- 集群状态信息
[omm@opengauss-node1 ~]$ gs_om -t status --detail --all
[   Cluster State   ]

cluster_state   : Normal
redistributing  : No
current_az      : AZ_ALL

[  Datanode State   ]

node               node_ip         instance                  state            | node               node_ip         instance                  state
------------------------------------------------------------------------------------------------------------------------------------------------------------------
1  opengauss-node1 192.168.17.136  6001 /gaussdb/data/db1 P Primary Normal | 2  opengauss-node2 192.168.17.137  6002 /gaussdb/data/db1 S Standby Normal
复制

三、补充

第一次对openGauss进行升级,升级过程中也遇到一些坑,特别要感谢(恩墨) 高云龙、黄超两位大牛的指导,解决了升级过程中的问题。升级过程中主要遇到如下坑。

3.1 升级前停止集群

在执行升级脚本前,我将集群停了,导致在执行升级命令时遇到如下报错:

[omm@opengauss-node1 ~]$ /opt/software/openGauss/script/gs_upgradectl -t auto-upgrade --grey -X /opt/software/openGauss/clusterconfig.xml
Static configuration matched with old static configuration files.
NOTICE: [GAUSS-52907] : Failed to cancel the cluster read-only mode
NOTICE: [GAUSS-52907] : Failed to cancel the cluster read-only mode
复制

然后在处理过程中执行了如下命令及报错信息如下:

-- 节点一执行 gs_guc reload -Z coordinator -N all -I all -c "default_transaction_read_only=false";gs_guc reload -Z datanode -N all -I all -c 
[omm@opengauss-node1 ~]$ gs_guc reload -Z coordinator -N all -I all -c "default_transaction_read_only=false";gs_guc reload -Z datanode -N all -I all -c "default_transaction_read_only=false"
-- 报错结果如下:
gs_guc: too many command-line arguments (first is "reload")
Try "gs_guc --help" for more information.

==================================================================
-- 节点一执行gs_guc reload  -N all -I all -c "default_transaction_read_only=off"
[omm@opengauss-node1 ~]$ gs_guc reload  -N all -I all -c "default_transaction_read_only=off"
-- 报错结果如下:
Begin to perform the total nodes: 2.
Popen count is 2, Popen success count is 2, Popen failure count is 0.
Begin to perform gs_guc for datanodes.
ERROR: Failed to execute gs_guc command: gs_guc reload  -I all -c "default_transaction_read_only=off" on node "opengauss-node1", error code is 1, please get more details from current node path "$GAUSSLOG/bin/gs_guc".
ERROR: Failed to execute gs_guc command: gs_guc reload  -I all -c "default_transaction_read_only=off" on node "opengauss-node2", error code is 1, please get more details from current node path "$GAUSSLOG/bin/gs_guc".
Command count is 2, Command success count is 0, Command failure count is 2.

Total nodes: 2. Failed nodes: 2.
Failed node names:
    [opengauss-node1]
    [opengauss-node2]
Retry to perform the failed nodes: 2.
Popen count is 2, Popen success count is 2, Popen failure count is 0.
Begin to perform gs_guc for datanodes.
ERROR: Failed to execute gs_guc command: gs_guc reload  -I all -c "default_transaction_read_only=off" on node "opengauss-node1", error code is 1, please get more details from current node path "$GAUSSLOG/bin/gs_guc".
ERROR: Failed to execute gs_guc command: gs_guc reload  -I all -c "default_transaction_read_only=off" on node "opengauss-node2", error code is 1, please get more details from current node path "$GAUSSLOG/bin/gs_guc".
Command count is 2, Command success count is 0, Command failure count is 2.

Total nodes: 2. Failed nodes: 2.
Failed node names:
    [opengauss-node1]
    [opengauss-node2]
Retry to perform the failed nodes: 2.
Popen count is 2, Popen success count is 2, Popen failure count is 0.
Begin to perform gs_guc for datanodes.
ERROR: Failed to execute gs_guc command: gs_guc reload  -I all -c "default_transaction_read_only=off" on node "opengauss-node1", error code is 1, please get more details from current node path "$GAUSSLOG/bin/gs_guc".
ERROR: Failed to execute gs_guc command: gs_guc reload  -I all -c "default_transaction_read_only=off" on node "opengauss-node2", error code is 1, please get more details from current node path "$GAUSSLOG/bin/gs_guc".
Command count is 2, Command success count is 0, Command failure count is 2.

Total nodes: 2. Failed nodes: 2.
Failed node names:
    [opengauss-node1]
    [opengauss-node2]
ALL: Failure to perform gs_guc!
复制

3.2 启动集群

然后在升级前将集群启动,再次执行升级命令遇到如下报错:

[omm@opengauss-node1 ~]$ /opt/software/openGauss/script/gs_upgradectl -t auto-upgrade --grey -X /opt/software/openGauss/clusterconfig.xml
Static configuration matched with old static configuration files.
Successfully set upgrade_mode to 0.
[GAUSS-52900] : Failed to upgrade strategy: [Errno 13] Permission denied: '/opt/software/openGauss/version.cfg'. Do nothing this time.
[GAUSS-52900] : Failed to upgrade strategy: [Errno 13] Permission denied: '/opt/software/openGauss/version.cfg'. Do nothing this time.

# 根据上面信息,显示因权限导致报错
-- 查看version.cfg文件权限
[omm@opengauss-node1 ~]$ ls -lrt /opt/software/openGauss/version.cfg
-r-------- 1 root root 32 Jun  2  2021 /opt/software/openGauss/version.cfg
-- 课件version.cfg文件属主和属组都是root,只读权限,可将其修改为omm用户和dbgrp属组,本次我直接将其权限修改为777,然后再次执行升级命令未报错。
复制
最后修改时间:2022-11-29 09:33:38
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

文章被以下合辑收录

评论

TA的专栏
崖山数据库
收录2篇内容
kingbaseES
收录2篇内容
ClickHouse
收录11篇内容
目录
  • 一、准备工作
    • 1.1 下载2.0.1 软件包
    • 1.2 解压2.0.1 软件包
    • 1.3 查看当前版本
    • 1.4 查看集群状态
    • 1.5 停止集群
    • 1.6 备份目录及文件
    • 1.7 启动集群
  • 二、集群升级
    • 2.1 升级前预检查
    • 2.2 执行升级
    • 2.3 信息检查
  • 三、补充
    • 3.1 升级前停止集群
    • 3.2 启动集群