👈【上一篇】
💖The Begin💖 点点关注,收藏不迷路💖
【下一篇】👉

🔻 前言

1、统信服务器操作系统是一款用于构建信息化基础设施环境的平台级软件。

产品主要面向于党政军、企事业单位、教育机构,以及普通的企业型用户,着重解决客户在信息化基础建设过程中,服务端基础设施的安装部署、运行维护、应用支撑等需求。

2、openGauss是一款开源关系型数据库管理系统,采用木兰宽松许可证v2发行。openGauss内核深度融合华为在数据库领域多年的经验,结合企业级场景需求,持续构建竞争力特性。
在这里插入图片描述

🔻 一、安装前准备

🔰 1.1 openGauss安装包下载

openGauss安装包下载,这里选择openGauss_5.0.0 企业版。

在这里插入图片描述

🔰 1.2 安装环境准备

⛳ 1.2.1 硬件环境要求
项目配置描述
内存1、功能调试建议32GB以上。2、性能测试和商业部署时,单实例部署建议128GB以上。3、复杂的查询对内存的需求量比较高,在高并发场景下,可能出现内存不足。此时建议使用大内存的机器,或使用负载管理限制系统的并发。
CPU1、功能调试最小1×8核,2.0GHz。2、性能测试和商业部署时,单实例部署建议1×16核,2.0GHz。3、CPU超线程和非超线程两种模式都支持。📜 说明:目前,openGauss仅支持鲲鹏服务器和基于x86_64通用PC服务器的CPU。
硬盘📜 用于安装openGauss的硬盘需最少满足如下要求:1、至少1GB用于安装openGauss的应用程序。2、每个主机需大约300MB用于元数据存储。3、预留70%以上的磁盘剩余空间用于数据存储。4、建议系统盘配置为RAID1,数据盘配置为RAID5,且规划4组RAID5数据盘用于安装openGauss。
网络要求1、300兆以上以太网。2、建议网卡设置为双网卡冗余bond。
⛳ 1.2.2 软件环境要求
软件类型配置描述
Linux操作系统🔖 ARM:openEuler 20.03LTS(推荐采用此操作系统)、麒麟V10。 🔖x86:openEuler 20.03LTS、CentOS 7.6。说明:当前安装包只能在英文操作系统上安装使用。
Linux文件系统剩余inode个数 > 15亿(推荐)
工具bzip2
Python支持Python3.6+
⛳ 1.2.3 软件依赖要求
所需软件建议版本
libaio-devel建议版本:0.3.109-13
flex要求版本:2.5.31 以上
bison建议版本:2.7-4
ncurses-devel建议版本:5.9-13.20130511
glibc-devel建议版本:2.17-111
patch建议版本:2.7.1-10
redhat-lsb-core建议版本:4.1
readline-devel建议版本:7.0-13
libnsl(openEuler+x86环境中)建议版本:2.28-36
##使用yum来安装依赖包或者使用uos-server-20-1060e.iso镜像挂载安装(小编采用镜像挂载安装有关依赖)
yum -y install libaio-devel flex bison ncurses-devel glibc-devel patch redhat-lsb-core readline-devel python3
⛳ 1.2.4 关闭操作系统防火墙、selinux

目前openGauss仅支持在防火墙关闭的状态下进行安装

1、修改/etc/selinux/config文件中的SELINUX值为disabled
[root@klgdj ~]# vim /etc/selinux/config

2、修改SELINUX的值为disabled
SELINUX=disabled

在这里插入图片描述

3、检查防火墙是否关闭
[root@klgdj ~]# systemctl status firewalld
若防火墙状态显示为active (running),则表示防火墙未关闭
若防火墙状态显示为inactive (dead),则无需再关闭防火墙

4、关闭防火墙并禁止开机重启
[root@klgdj ~]# systemctl disable firewalld.service
[root@klgdj ~]# systemctl stop firewalld.service

⛳ 1.2.5 设置字符集参数

###将数据库节点的字符集设置为en_US.UTF-8
echo “LANG=en_US.UTF-8” >> /etc/profile
source /etc/profile
echo $LANG

在这里插入图片描述

⛳ 1.2.6 设置时区和时间

###查询时区
[root@klgdj ~]# timedatectl
[root@klgdj ~]# timedatectl list-timezones |grep Shanghai
[root@klgdj ~]# timedatectl set-timezone Asia/Shanghai

在这里插入图片描述

--------若为集群模式需要使用date -s命令将各主机的时间设置为统一时间。
[root@klgdj ~]# date -s “2023-06-17 16:39:50”

在这里插入图片描述

-------可以通过date命令查询主机时区
[root@klgdj ~]# date
Sat Jun 17 16:41:03 CST 2023

⛳ 1.2.7 关闭swap交换内存(可选)

关闭swap交换内存是为了保障数据库的访问性能,避免把数据库的缓冲区内存淘汰到磁盘上。 如果服务器内存比较小,内存过载时,可打开swap交换内存保障正常运行。

###使用swapoff -a命令将交换内存关闭—集群模式则需要各节点执行
###关闭命令
[root@klgdj ~]# swapoff -a

###开启命令
[root@klgdj ~]# swapon -a

⛳ 1.2.8 设置网卡MTU值

将各数据库节点的网卡MTU值设置为相同大小。对于x86,MTU值推荐1500;对于ARM,MTU值推荐8192

###查询服务器的网卡名称
[root@klgdj ~]# ifconfig
在这里插入图片描述

###设置网卡MTU值设置为8192,---集群模式则需要各节点执行
[root@klgdj ~]# ifconfig ens33 mtu 8192

⛳ 1.2.9 关闭RemoveIPC

集群模式则需要各节点上执行,关闭RemoveIPC。CentOS操作系统无该参数,可以跳过该步骤。

###`关闭RemoveIPC`
[root@klgdj ~]# sed -i '/^RemoveIPC/d' /etc/systemd/logind.conf
[root@klgdj ~]# sed -i '/^RemoveIPC/d' /usr/lib/systemd/system/systemd-logind.service[root@klgdj ~]# echo "RemoveIPC=no"  >> /etc/systemd/logind.conf
[root@klgdj ~]# echo "RemoveIPC=no"  >> /usr/lib/systemd/system/systemd-logind.service
   	

###重新加载配置参数
[root@klgdj ~]# systemctl daemon-reload
[root@klgdj ~]# systemctl restart systemd-logind

###检查修改是否生效
[root@klgdj ~]# loginctl show-session | grep RemoveIPC
RemoveIPC=no
[root@klgdj ~]# systemctl show systemd-logind | grep RemoveIPC
RemoveIPC=no
[root@klgdj ~]#

在这里插入图片描述

⛳ 1.2.10 设置root用户远程登录(可选)

修改PermitRootLogin配置,允许root用户远程登录,root用户默认是可登录的,否则需要修改。

##修改sshd_config文件
vim /etc/ssh/sshd_config

###修改权限配置,可以使用以下两种方式实现
1、 注释掉“PermitRootLogin no”
#PermitRootLogin no

2、将“PermitRootLogin”改为“yes”
PermitRootLogin yes

⛳ 1.2.11 配置Banner

修改Banner配置,去掉连接到系统时,系统提示的欢迎信息。欢迎信息会干扰安装时远程操作的返回结果,影响安装正常执行。

###编辑sshd_config文件
vim /etc/ssh/sshd_config

###修改Banner配置,注释掉“Banner”所在的行
#Banner XXXX

在这里插入图片描述

###使设置生效
systemctl restart sshd.service

⛳ 1.2.12 了解安装用户及用户组

在安装openGauss过程中运行“gs_install”时,会创建与安装用户同名的数据库用户,即数据库用户omm。此用户具备数据库的最高操作权限,此用户初始密码由用户指定。

在这里插入图片描述

🔻 二、系统资源参数配置

🔰 2.1 设置sysctl.conf(可选)

###vi /etc/sysctl.conf 

net.ipv4.tcp_retries1 = 5
net.ipv4.tcp_syn_retries = 5
net.sctp.path_max_retrans = 10
net.sctp.max_init_retransmits = 10
net.ipv4.tcp_max_tw_buckets = 10000
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_keepalive_time = 30
net.ipv4.tcp_keepalive_intvl = 30
net.ipv4.tcp_retries2 = 12
net.ipv4.ip_local_reserved_ports = 15400-15407,20050-20057
net.core.wmem_max = 21299200
net.core.rmem_max = 21299200
net.core.wmem_default = 21299200
net.core.rmem_default = 21299200
kernel.sem = 250 6400000 1000 25600
net.ipv4.tcp_rmem = 8192 250000 16777216
net.ipv4.tcp_wmem = 8192 250000 16777216
vm.min_free_kbytes = 201318
net.core.netdev_max_backlog = 65535
net.ipv4.tcp_max_syn_backlog = 65535
net.core.somaxconn = 65535
kernel.shmall = 1152921504606846720
kernel.shmmax = 18446744073709551615

🔰 2.2 配置资源限制

###`配置资源限制`
echo "* soft stack 3072" >> /etc/security/limits.conf
echo "* hard stack 3072" >> /etc/security/limits.conf
echo "* soft nofile 1000000" >> /etc/security/limits.conf
echo "* hard nofile 1000000" >> /etc/security/limits.conf
echo "* soft nproc unlimited" >> /etc/security/limits.d/90-nproc.conf
	    		 
###`查看配置`
tail -n 4 /etc/security/limits.conf
tail -n 1 /etc/security/limits.d/90-nproc.conf

在这里插入图片描述

🔰 2.3 关闭透明大页

echo never > /sys/kernel/mm/transparent_hugepage/defrag
echo never > /sys/kernel/mm/transparent_hugepage/enabled
  		 
echo 'echo never > /sys/kernel/mm/transparent_hugepage/defrag' >> /etc/rc.d/rc.local
echo 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' >> /etc/rc.d/rc.local[root@klgdj ~]# chmod +x /etc/rc.d/rc.local
[root@klgdj ~]# /usr/bin/sh /etc/rc.d/rc.local

在这里插入图片描述

🔻 三、预安装

确保有关依赖是否安装完成,见【⛳ 1.2.3 软件依赖要求】。

🔰 3.1 创建安装目录

以root用户登录待安装openGauss主机,按规划创建存放安装包的目录。

注意:

  • 不建议把安装包的存放目录规划到openGauss用户的根目录或其子目录下,可能导致权限问题。

  • openGauss用户须具有/opt/software/openGauss目录的读写权限。

###创建安装目录
mkdir -p /opt/software/openGauss
chmod 755 -R /opt/software

🔰 3.2 上传并解压安装包

在安装包所在的目录下,解压安装包openGauss-x.x.x-openEuler-64bit-all.tar.gz。

安装包解压后,会有OM安装包和Server安装包。

继续解压OM安装包,会在/opt/software/openGauss路径下自动生成script子目录,并且在script目录下生成gs_preinstall等各种OM工具脚本。

###将openGauss-5.0.0安装包解压至 /opt/software/openGauss/
[root@klgdj openGauss]# tar -zxvf openGauss-5.0.0-openEuler-64bit-all.tar.gz -C /opt/software/openGauss/

###继续解压OM安装包
[root@klgdj openGauss]# tar -zxvf openGauss-5.0.0-openEuler-64bit-om.tar.gz

在这里插入图片描述

###再次更改目录权限
chmod -R 777 /opt/software/openGauss
在这里插入图片描述

🔰 3.3 创建XML配置文件

官方单节点模板:

###单节点配置文件
<?xml version="1.0" encoding="UTF-8"?>
<ROOT>
    <!-- openGauss整体信息 -->
    <CLUSTER>
        <!-- 数据库名称 -->
        <PARAM name="clusterName" value="dbCluster" />
        <!-- 数据库节点名称(hostname) -->
        <PARAM name="nodeNames" value="node1_hostname" />
        <!-- 数据库安装目录-->
        <PARAM name="gaussdbAppPath" value="/opt/huawei/install/app" />
        <!-- 日志目录-->
        <PARAM name="gaussdbLogPath" value="/var/log/omm" />
        <!-- 临时文件目录-->
        <PARAM name="tmpMppdbPath" value="/opt/huawei/tmp" />
        <!-- 数据库工具目录-->
        <PARAM name="gaussdbToolPath" value="/opt/huawei/install/om" />
        <!-- 数据库core文件目录-->
        <PARAM name="corePath" value="/opt/huawei/corefile" />
        <!-- 节点IP,与数据库节点名称列表一一对应 -->
        <PARAM name="backIp1s" value="192.168.0.1"/> 
    </CLUSTER>
    <!-- 每台服务器上的节点部署信息 -->
    <DEVICELIST>
        <!-- 节点1上的部署信息 -->
        <DEVICE sn="node1_hostname">
            <!-- 节点1的主机名称 -->
            <PARAM name="name" value="node1_hostname"/>
            <!-- 节点1所在的AZ及AZ优先级 -->
            <PARAM name="azName" value="AZ1"/>
            <PARAM name="azPriority" value="1"/>
            <!-- 节点1的IP,如果服务器只有一个网卡可用,将backIP1和sshIP1配置成同一个IP -->
            <PARAM name="backIp1" value="192.168.0.1"/>
            <PARAM name="sshIp1" value="192.168.0.1"/>
               
	    <!--dbnode-->
	    <PARAM name="dataNum" value="1"/>
	    <PARAM name="dataPortBase" value="15400"/>
	    <PARAM name="dataNode1" value="/opt/huawei/install/data/dn"/>
            <PARAM name="dataNode1_syncNum" value="0"/>
        </DEVICE>
    </DEVICELIST>
</ROOT>

需要修改的地方:

数据库节点名称
nodeNames value=node1_hostname
sn=node1_hostname
把value后面的值改为主机名

IP地址
节点IP,与数据库节点名称列表一一对应
backIp1s value=192.168.xxx.xxx
backIp1 value=192.168.xxx.xxx
sshIp1 value=192.168.xxx.xxx

端口
dataPortBase value=15400

修改之后的模板:

<?xml version="1.0" encoding="UTF-8"?>
<ROOT>
    <!-- openGauss整体信息 -->
    <CLUSTER>
     <!-- 数据库名称 -->
     <PARAM name="clusterName" value="dbCluster" />
     <!-- 数据库节点名称(hostname) -->
     <PARAM name="nodeNames" value="klgdj" />
     <!-- 数据库安装目录-->
     <PARAM name="gaussdbAppPath" value="/opt/software/install/app" />
     <!-- 日志目录-->
     <PARAM name="gaussdbLogPath" value="/var/log/omm" />
     <!-- 临时文件目录-->
     <PARAM name="tmpMppdbPath" value="/opt/software/tmp" />
     <!-- 数据库工具目录-->
     <PARAM name="gaussdbToolPath" value="/opt/software/install/om" />
     <!-- 数据库core文件目录-->
     <PARAM name="corePath" value="/opt/software/corefile" />
     <!-- 节点IP,与数据库节点名称列表一一对应 -->
     <PARAM name="backIp1s" value="192.168.181.71"/> 
   </CLUSTER>
    <!-- 每台服务器上的节点部署信息 -->
    <DEVICELIST>
        <!-- 节点1上的部署信息 -->
        <DEVICE sn="node1_hostname">
            <!-- 节点1的主机名称 -->
            <PARAM name="name" value="klgdj"/>
            <!-- 节点1所在的AZ及AZ优先级 -->
            <PARAM name="azName" value="AZ1"/>
            <PARAM name="azPriority" value="1"/>
            <!-- 节点1的IP,如果服务器只有一个网卡可用,将backIP1和sshIP1配置成同一个IP -->
            <PARAM name="backIp1" value="192.168.181.71"/>
            <PARAM name="sshIp1" value="192.168.181.71"/>
               
	    <!--dbnode-->
	    <PARAM name="dataNum" value="1"/>
	    <PARAM name="dataPortBase" value="15400"/>
	    <PARAM name="dataNode1" value="/opt/software/install/data/dn"/>
            <PARAM name="dataNode1_syncNum" value="0"/>
        </DEVICE>
    </DEVICELIST>
</ROOT>

###在/opt/software/openGauss 路径下,创建一个名为 cluster_config.xml的文件

[root@klgdj openGauss]# vim cluster_config.xml
在这里插入图片描述

🔰 3.4 执行预安装脚本

在执行前置脚本gs_preinstall时,需要规划好openGauss配置文件路径、安装包存放路径、程序安装目录、实例数据目录,后续普通用户使用过程中不能再更改这些路径。

###执行下面命令准备安装环境
[root@klgdj ~]# cd /opt/software/openGauss/script
[root@klgdj script]# ./gs_preinstall -U omm -G dbgrp -X /opt/software/openGauss/cluster_config.xml

注:
omm为数据库管理员(也是运行openGauss的操作系统用户),dbgrp为运行openGauss的操作系统用户的群组名称。

/opt/software/openGauss/cluster_config.xml为openGauss配置文件路径。在执行过程中,用户根据提示选择是否创建互信,并输入操作系统root用户或omm用户的密码。

❌ 报错1:Exception: [GAUSS-51900] : The current OS is not supported.
[root@klgdj script]# ./gs_preinstall -U omm -G dbgrp -X /opt/software/openGauss/clusterconfig.xml
“Traceback (most recent call last):
File “./gs_preinstall”, line 40, in
from gspylib.common.Common import DefaultValue
File “/opt/software/openGauss/script/gspylib/common/Common.py”, line 101, in
from os_platform.UserPlatform import g_Platform
File “/opt/software/openGauss/script/os_platform/UserPlatform.py”, line 67, in
g_Platform = UserPlatform().userPlatform
File “/opt/software/openGauss/script/os_platform/UserPlatform.py”, line 50, in init
SUPPORT_WHOLE_PLATFORM_LIST))
Exception: [GAUSS-51900] : The current OS is not supported.Supported platforms are: [‘suse’, ‘redhat’, ‘centos’,
‘euleros’, ‘openeuler’, ‘kylin’, ‘fusionos’, ‘asianux’, ‘debian’, ‘ubuntu’].”
在这里插入图片描述
注:openGauss适配BCLinux欧拉版,在执行预安装检测时,会进行操作系统检测,具体在/opt/software/openGauss/script/os_platform/linux_distro.py 文件查看。

_supported_dists = (
‘SuSE’, ‘debian’, ‘fedora’, ‘redhat’, ‘centos’, ‘euleros’, “openEuler”,
‘mandrake’, ‘mandriva’, ‘rocks’, ‘slackware’, ‘yellowdog’, ‘gentoo’,
“FusionOS”, ‘UnitedLinux’, ‘turbolinux’, ‘ubuntu’, ‘kylin’, ‘asianux’)

✅ 报错1解决方---法1(没试过):

 ###查看当前服务器系统的版本,版本号,内核号
 ll /etc/|grep -E 'release$|version$'  
 或者 
 ll -sh --full-time /etc/ |grep -i 'release'

在这里插入图片描述

排除掉软链接文件
UnionTech-release、os-release
可以看到UnionTech、os无法在_supported_dists中找到。

解决办法
rm -f /etc/openEuler-release #将软链接删掉
cp /etc/UnionTech-release /etc/openEuler-release #复制一份openEuler-release

✅ 报错1解决方---法2(小编使用的这个):
[root@klgdj ~]# cd /etc
[root@klgdj etc]# find -name ‘*release’
./UnionTech-release
./lsb-release
./os-release
./system-release
./openEuler-release
[root@klgdj etc]#
在这里插入图片描述

[root@klgdj etc]# cp -rp UnionTech-release openEuler-release

[root@klgdj etc]# vim openEuler-release
修改为:openeuler release 20.03 LTS
在这里插入图片描述

###再次执行预安装脚本
[root@klgdj script]# ./gs_preinstall -U omm -G dbgrp -X /opt/software/openGauss/cluster_config.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.
Setting host ip env
Successfully set host ip env.
Are you sure you want to create the user[omm] (yes/no)? yes
Please enter password for cluster user.
Password:
Please enter password for cluster user again.
Password:
❌ 报错2: [GAUSS-51103] : Failed to execute the PSSH command [encrypt ...].Error is:./encrypt: error while loading shared libraries: libreadline.so.7: cannot open shared object file: No such file or directory在这里插入图片描述

✅ 解决报错2---找不到libreadline.so.7文件:
###查找libreadline.so有关文件
[root@klgdj script]# find / -name libreadline.so
find: ‘/run/user/994/gvfs’: Permission denied
/usr/lib64/libreadline.so.8
/usr/lib64/libreadline.so.8.0
[root@klgdj script]#

####添加软连接
ln -s /usr/lib64/libreadline.so.8.0 /usr/lib64/libreadline.so.7.0
ln -s /usr/lib64/libreadline.so.8 /usr/lib64/libreadline.so.7
在这里插入图片描述

###再次执行预安装脚本
[root@klgdj script]#./gs_preinstall -U omm -G dbgrp -X /opt/software/openGauss/cluster_config.xml

❌报错3--install文件夹必须为空(原因,前面多次执行,创建了一个install 文件夹,需要删除,重新执行脚本)

[GAUSS-50202] : The /opt/software/install must be empty. Or user [omm] has write permission to directory /opt/software/install. Because it will create symbolic link [/opt/software/install/app] to install path [/opt/software/install/app_a07d57c3] in gs_install process with this user.

✅ 解决报错3--- /opt/software/install 必须为空
###清空 /opt/software/install 文件夹
[root@klgdj script]# rm -rf /opt/software/install

###再次执行预安装脚本----无任何报错
[root@klgdj script]#./gs_preinstall -U omm -G dbgrp -X /opt/software/openGauss/cluster_config.xml

###预安装过程
[root@klgdj script]# ./gs_preinstall -U omm -G dbgrp -X /opt/software/openGauss/cluster_config.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.
Setting host ip env
Successfully set host ip env.
Are you sure you want to create the user[omm] (yes/no)? yes
Preparing SSH service.
Successfully prepared SSH service.
Checking OS software.
Successfully check os software.
Checking OS version.
Successfully checked OS version.
Creating cluster's path.
Successfully created cluster's path.
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 klgdj --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.
Setting Cgroup.
Successfully set Cgroup.
Set ARM Optimization.
No need to set ARM Optimization.
Fixing server package owner.
Setting finish flag.
Successfully set finish flag.
Preinstallation succeeded.
[root@klgdj script]# 

🔰 3.5 检查系统环境

[root@klgdj script]# ./gs_checkos -i A -h klgdj --detail
Checking items:
    A1. [ OS version status ]                                   : Normal     
        [klgdj]
        openEuler_20.03_64bit
             
    A2. [ Kernel version status ]                               : Normal     
        The names about all kernel versions are same. The value is "4.19.90-2305.1.0.0199.56.uel20.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 ]                    : Abnormal   
        [klgdj]
        Abnormal reason: variable 'net.ipv4.tcp_max_tw_buckets' RealValue '16384' ExpectedValue '10000'.
        Abnormal reason: variable 'net.ipv4.tcp_tw_reuse' RealValue '2' ExpectedValue '1'.
        Abnormal reason: variable 'net.ipv4.tcp_keepalive_time' RealValue '7200' ExpectedValue '30'.
        Abnormal reason: variable 'net.ipv4.tcp_keepalive_intvl' RealValue '75' ExpectedValue '30'.
        Abnormal reason: variable 'net.ipv4.tcp_retries2' RealValue '15' ExpectedValue '12'.
        Abnormal reason: variable 'net.core.wmem_max' RealValue '212992' ExpectedValue '21299200'.
        Abnormal reason: variable 'net.core.rmem_max' RealValue '212992' ExpectedValue '21299200'.
        Abnormal reason: variable 'net.core.wmem_default' RealValue '212992' ExpectedValue '21299200'.
        Abnormal reason: variable 'net.core.rmem_default' RealValue '212992' ExpectedValue '21299200'.
        Abnormal reason: variable 'kernel.sem' RealValue '32000	1024000000	500	32000' ExpectedValue '250 6400000 1000 25600'.
        Abnormal reason: variable 'net.ipv4.tcp_rmem' RealValue '4096	131072	6291456' ExpectedValue '8192 250000 16777216'.
        Abnormal reason: variable 'net.ipv4.tcp_wmem' RealValue '4096	16384	4194304' ExpectedValue '8192 250000 16777216'.
        Warning reason: variable 'vm.min_free_kbytes' RealValue '112640' ExpectedValue '173849'.
        Abnormal reason: variable 'net.core.netdev_max_backlog' RealValue '1000' ExpectedValue '65535'.
        Abnormal reason: variable 'net.ipv4.tcp_max_syn_backlog' RealValue '128' ExpectedValue '65535'.
        Abnormal reason: variable 'net.core.somaxconn' RealValue '128' ExpectedValue '65535'.
        Abnormal reason: variable 'kernel.shmall' RealValue '18446744073692774399' ExpectedValue '1152921504606846720'.
        Abnormal reason: variable 'kernel.shmmax' RealValue '18446744073692774399' ExpectedValue '18446744073709551615'.
        Warning reason: variable 'net.ipv4.tcp_retries1' RealValue '3' ExpectedValue '5'.
        Warning reason: variable 'net.ipv4.tcp_syn_retries' RealValue '6' ExpectedValue '5'.
        Check_SysCtl_Parameter failed.

    A7. [ File system configuration status ]                    : Warning    
        [klgdj]
        Warning reason: variable 'max user processes' RealValue '13364' ExpectedValue 'unlimited'

    A8. [ Disk configuration status ]                           : Normal     
        The value about XFS mount parameters is correct.   
    A9. [ Pre-read block size status ]                          : Abnormal   
        [klgdj]
On device (/dev/sda) 'blockdev readahead' RealValue '8192' ExpectedValue '16384'.

BondMode Null
    A11.[ Network card configuration status ]                   : Normal     
        The configuration about network card is correct.   
    A12.[ Time consistency status ]                             : Warning    
        [klgdj]
        The NTPD not detected on machine and local time is "2023-06-18 01:04:12".

    A13.[ Firewall service status ]                             : Normal     
        The firewall service is stopped.                   
    A14.[ THP service status ]                                  : Normal     
        The THP service is stopped.                        
Total numbers:13. Abnormal numbers:2. Warning numbers:2.
Do checking operation finished. Result: Abnormal.
[root@klgdj script]# 

🔻 四、开始安装openGauss数据库

  • omm指的是前置脚本gs_preinstall中-U参数指定的用户。
  • 安装脚本gs_install必须以前置脚本中指定的omm执行,否则,脚本执行会报错。
  • openGauss在海思高版本芯片上编译的不能在海思低版本芯片的服务器上运行,比如Hi620编译的版本不能在Hi1616环境上运行。

🔰 4.1 切换omm用户

###必须使用上面预安装指定的omm用户进行安装,omm用户为运行openGauss的用户。
–omm(klgdj@2023)

[root@klgdj ~]# su - omm
Last login: Sun Jun 18 01:48:50 CST 2023
Welcome to 4.19.90-2305.1.0.0199.56.uel20.x86_64

System information as of time: Sun Jun 18 01:58:13 CST 2023

System load: 0.07
Processes: 245
Memory used: 19.6%
Swap used: 0.0%
Usage On: 20%
IP address: 192.168.181.71
Users online: 1
To run a command as administrator(user “root”),use “sudo ”.
[omm@klgdj ~]$

🔰 4.2 开始安装

###使用gs_install安装openGauss
[omm@klgdj ~]$ gs_install -X /opt/software/openGauss/cluster_config.xml

在执行过程中,用户需根据提示输入数据库的密码,密码具有一定的复杂度,为保证用户正常使用该数据库,请记住输入的数据库密码。

设置的密码要符合复杂度要求:

1、最少包含8个字符。
2、不能和用户名、当前密码(ALTER)、或当前密码反序相同。
3、 至少包含大写字母(A-Z),小写字母(a-z),数字,非字母数字字符(限定为~!@#$%^&*()-_=+|[{}];:,<.>/?)四类字符中的三类字符。
4、 安装过程中会生成ssl证书,证书存放路径为{gaussdbAppPath}/share/sslcert/om,其中{gaussdbAppPath}为openGauss配置文件中指定的程序安装目录。
5、日志文件路径下会生成两个日志文件:“gs_install-YYYY-MMDD_HHMMSS.log”和“gs_local-YYYY-MM-DD_HHMMSS.log”。

###安装过程--(数据库密码klgdj@2023)
[omm@klgdj ~]$ gs_install -X /opt/software/openGauss/cluster_config.xml
Parsing the configuration file.
Check preinstall on every node.
Successfully checked preinstall on every node.
Creating the backup directory.
Successfully created the backup directory.
begin deploy..
Installing the cluster.
begin prepare Install Cluster..
Checking the installation environment on all nodes.
begin install Cluster..
Installing applications on all nodes.
Successfully installed APP.
begin init Instance..
encrypt cipher and rand files for database.
Please enter password for database:
Please repeat for database:
begin to create CA cert files
The sslcert will be generated in /opt/software/install/app/share/sslcert/om
NO cm_server instance, no need to create CA for CM.
Non-dss_ssl_enable, no need to create CA for DSS
Cluster installation is completed.
Configuring.
Deleting instances from all nodes.
Successfully deleted instances from all nodes.
Checking node configuration on all nodes.
Initializing instances on all nodes.
Updating instance configuration on all nodes.
Check consistence of memCheck and coresCheck on database nodes.
Configuring pg_hba on all nodes.
Configuration is completed.
The cluster status is Normal.
Successfully started cluster.
Successfully installed application.
end deploy..
[omm@klgdj ~]$ 

--------------------------------✅至此openGauss安装成功

🔰 4.3 验证openGauss数据库

###在omm用户下执行
[omm@klgdj ~]$ su - omm
[omm@klgdj ~]$ gs_om -t status
-----------------------------------------------------------------------

cluster_name    : dbCluster
cluster_state   : Normal
redistributing  : No

-----------------------------------------------------------------------
[omm@klgdj ~]$ 

cluster_name : dbCluster ----数据库名称为dbCluster
cluster_state : Normal ----表示已启动,可以正常使用,如果状态不是Normal表示不可用。
redistributing : No----表示

⛳ 4.3.1 查询openGauss各个节点信息(单节点)
[omm@klgdj ~]$  gs_om -t status --all 
或者使用
#####使用date标记,测试响应时间
[omm@klgdj ~]$  date && gs_om -t status --detail && date 
-----------------------------------------------------------------------

cluster_state             : Normal
redistributing            : No

-----------------------------------------------------------------------

node                      : 1
node_name                 : klgdj
instance_id               : 6001
node_ip                   : 192.168.181.71
data_path                 : /opt/software/install/data/dn
instance_port             : 15400
type                      : Datanode
instance_state            : Normal
az_name                   : AZ1
instance_role             : Normal

-----------------------------------------------------------------------

[omm@klgdj ~]$ 
⛳ 4.3.2 登录openGauss
[omm@klgdj ~]$ gsql -d postgres -p 15400
gsql ((openGauss 5.0.0 build a07d57c3) compiled at 2023-03-29 03:09:38 commit 0 last mr  )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.

openGauss=# 

🔰 4.4 openGauss简单使用

⛳ 4.4.1 启停openGauss数据库服务
###停止openGauss数据库服务
[omm@klgdj ~]$ gs_om -t stop
Stopping cluster.
=========================================
Successfully stopped cluster.
=========================================
End stop cluster.
###开启openGauss数据库服务
[omm@klgdj ~]$ gs_om -t start
Starting cluster.
=========================================
[SUCCESS] klgdj
2023-06-18 23:40:38.407 648dfe26.1 [unknown] 140086535090112 [unknown] 0 dn_6001 01000  0 [BACKEND] WARNING:  could not create any HA TCP/IP sockets
2023-06-18 23:40:38.407 648dfe26.1 [unknown] 140086535090112 [unknown] 0 dn_6001 01000  0 [BACKEND] WARNING:  could not create any HA TCP/IP sockets
2023-06-18 23:40:38.408 648dfe26.1 [unknown] 140086535090112 [unknown] 0 dn_6001 01000  0 [BACKEND] WARNING:  Failed to initialize the memory protect for g_instance.attr.attr_storage.cstore_buffers (1024 Mbytes) or shared memory (3313 Mbytes) is larger.
=========================================
Successfully started.
###openGauss数据库服务状态查看
[omm@klgdj ~]$ gs_om -t status
-----------------------------------------------------------------------

cluster_name    : dbCluster
cluster_state   : Normal
redistributing  : No

-----------------------------------------------------------------------
###重启openGauss数据库服务
[omm@klgdj ~]$ gs_om -t restart
Stopping cluster.
=========================================
Successfully stopped cluster.
=========================================
End stop cluster.
Starting cluster.
=========================================
[SUCCESS] klgdj
2023-06-18 23:41:07.087 648dfe43.1 [unknown] 140034726731712 [unknown] 0 dn_6001 01000  0 [BACKEND] WARNING:  could not create any HA TCP/IP sockets
2023-06-18 23:41:07.088 648dfe43.1 [unknown] 140034726731712 [unknown] 0 dn_6001 01000  0 [BACKEND] WARNING:  could not create any HA TCP/IP sockets
2023-06-18 23:41:07.089 648dfe43.1 [unknown] 140034726731712 [unknown] 0 dn_6001 01000  0 [BACKEND] WARNING:  Failed to initialize the memory protect for g_instance.attr.attr_storage.cstore_buffers (1024 Mbytes) or shared memory (3313 Mbytes) is larger.
=========================================
Successfully started.
[omm@klgdj ~]$ 
⛳ 4.4.2 有关启停过程中警告问题梳理
  • socket问题----> WARNING: could not create any HA TCP/IP sockets
    1、前两个报错根据百度查询是主备复制时使用;
    2、当前opengauss是单机版,报这个警告可以忽略。

  • memory问题---->WARNING: Failed to initialize the memory protect for g_instance.attr.attr_storage.cstore_buffers (1024 Mbytes) or shared memory (3313 Mbytes) is larger.

    1、Failed to initialize the memory protect—无法初始化内存保护;
    shared_buffers的默认值为1GB, 当服务器的物理内存较小时,会导致内存保护启用失效。

free -h 查看内存空间
在这里插入图片描述total: 内存总数

used: 已经使用内存数

free: 完全空闲内存

shared: 多个进程共享的内存

buffers: 用于块设备数据缓冲,记录文件系统metadata(目录,权限,属性等)

cached: 用于文件内容的缓冲

available:真正剩余的可被程序应用的内存数

2、解决办法:数据库系统参数调优
法一:将max_process_memory调大,让
max_process_memory –shared
memory -cstore_buffers大于2G就不会报错;
法二:如果不需要列存储缓存,可以将cstore_buffers参数调低;
法三:将shared_buffers调低,这个参数对shared memory的影响非常大。

🔰 4.5 安装生成的目录

安装后的目录及各目录下的文件。

在这里插入图片描述

🔻 总结—温故知新

❓ openGauss数据库、统信操作系统了解
❓ openGauss数据库安装软硬件环境要求
❓ openGauss数据库有关资源参数设置
❓ openGauss数据库安装及有关报错解决
❓ openGauss数据库简单使用

👈【上一篇】
💖The End💖 点点关注,收藏不迷路💖
【下一篇】👉
Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐