安装opengauss企业版单机流程
安装前环境准备
1、对应架构的opengauss的压缩包:
openGauss-5.0.3-CentOS-64bit-all.tar.gz
2、对应的单机或者集群的配置文件模板(可以直接再官网获取模板)
注意项:主机名需要和服务器主机名保持一致
cluster_config.xml
<?xml version="1.0" encoding="UTF-8"?>
<ROOT>
<!-- openGauss整体信息 -->
<CLUSTER>
<!-- 数据库名称 -->
<PARAM name="clusterName" value="db_single" />
<!-- 数据库节点名称(hostname) -->
<PARAM name="nodeNames" value="node1" />
<!-- 数据库安装目录-->
<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="172.22.67.46"/>
</CLUSTER>
<!-- 每台服务器上的节点部署信息 -->
<DEVICELIST>
<!-- 节点1上的部署信息 -->
<DEVICE sn="node1">
<!-- 节点1的主机名称 -->
<PARAM name="name" value="node1"/>
<!-- 节点1所在的AZ及AZ优先级 -->
<PARAM name="azName" value="AZ1"/>
<PARAM name="azPriority" value="1"/>
<!-- 节点1的IP,如果服务器只有一个网卡可用,将backIP1和sshIP1配置成同一个IP -->
<PARAM name="backIp1" value="172.22.67.46"/>
<PARAM name="sshIp1" value="172.22.67.46"/>
<!--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>
3、依赖包
安装opengauss需要安装好tar、bzip2、libaio-devel,否则安装过程中报相应的命令不存在
4、需要创建安装opengauss的用户以及组,并将用户放到组里
安装流程
1、创建压缩包和配置文件的存放目录,并将压缩包和配置文件放入
mkdir -p /opt/software/openGauss
chmod 755 -R /opt/software
cp openGauss-5.0.3-CentOS-64bit-all.tar.gz /opt/software/opengauss
cp cluster_config.xml /opt/software/opengauss
2、解压压缩包
tar -xf openGauss-5.0.3-CentOS-64bit-all.tar.gz
查看解压的内容
openGauss-5.0.3-CentOS-64bit-all.tar.gz openGauss-5.0.3-CentOS-64bit-om.sha256 openGauss-5.0.3-CentOS-64bit.tar.bz2
openGauss-5.0.3-CentOS-64bit-cm.sha256 openGauss-5.0.3-CentOS-64bit-om.tar.gz upgrade_sql.sha256
openGauss-5.0.3-CentOS-64bit-cm.tar.gz openGauss-5.0.3-CentOS-64bit.sha256 upgrade_sql.tar.gz
继续当前目录下解压
tar -xf openGauss-5.0.3-CentOS-64bit-om.tar.gz
tar -xf openGauss-5.0.3-CentOS-64bit-cm.tar.gz
查看解压后内容
cluster_config.xml openGauss-5.0.3-CentOS-64bit-om.sha256 share
lib openGauss-5.0.3-CentOS-64bit-om.tar.gz tool
libcgroup openGauss-5.0.3-CentOS-64bit.sha256 upgrade_sql.sha256
openGauss-5.0.3-CentOS-64bit-all.tar.gz openGauss-5.0.3-CentOS-64bit.tar.bz2 upgrade_sql.tar.gz
openGauss-5.0.3-CentOS-64bit-cm.sha256 openGauss-Package-bak_89d144c2.tar.gz version.cfg
openGauss-5.0.3-CentOS-64bit-cm.tar.gz script
3、执行预安装命令
-U 用户名 -G 组名 -X 配置文件地址
cd /opt/software/opengauess/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/opengauess/script/gs_checkos -i A -h node1 --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.
4、正式安装
1、切换到安装用户omm
su - omm
2、修改权限允许omm用户访问/opt/software/opengauss目录下内容
chown -R omm:dbgrp /opt/software/opengauss
3、执行安装命令gs_install
cd /opt/software/opengauss/script
./gs_install -X /opt/software/opengauss/cluster_config.xml
5、安装用户启动
gs_om -t start
Starting cluster.
=========================================
[SUCCESS] node1
2024-09-06 15:27:58.933 66daaefe.1 [unknown] 139950082298176 [unknown] 0 dn_6001 01000 0 [BACKEND] WARNING: could not create any HA TCP/IP sockets
2024-09-06 15:27:58.933 66daaefe.1 [unknown] 139950082298176 [unknown] 0 dn_6001 01000 0 [BACKEND] WARNING: could not create any HA TCP/IP sockets
2024-09-06 15:27:58.937 66daaefe.1 [unknown] 139950082298176 [unknown] 0 dn_6001 01000 0 [BACKEND] WARNING: Failed to initial ize the memory protect for g_instance.attr.attr_storage.cstore_buffers (1024 Mbytes) or shared memory (1516 Mbytes) is larger.
=========================================
Successfully started.
6、验证
normal表示正常使用
gs_om -t status
-----------------------------------------------------------------------
cluster_name : db_single
cluster_state : Normal
redistributing : No
问题:
1、内存不足导致启动报错:
This error usually means that openGauss's request for a shared memory segment exceeded available memory or swap space, or exceeded your kernel's SH MALL parameter. You can either reduce the request size or reconfigure the kernel with larger SHMALL. To reduce the request size (currently 2482694472 bytes), reduce openGauss's shared memory usage, perhaps by reducing shared_buffers
解决办法:
dd if=/dev/zero of=/var/swapfile bs=128MB count=16
mkswap /var/swapfile
chmod 600 /var/swapfile
swapon /var/swapfile
查看swap空间
free -m
total used free shared buff/cache available
Mem: 1756 147 247 0 1362 1326
Swap: 1953 0 1953