环境介绍
硬件环境
cpu:HUAWEI Kunpeng 920 5220两颗
内存128G
raid卡:9440-8i
硬盘:两块960固态做raid1
网口:四口千兆
系统环境
这里使用高斯数据库推荐兼容的22.03
openEuler-22.03-LTS-SP4
旧版本高斯数据库安装参见我的另外一个博客
华为高斯数据库openGauss_5.0.2 企业版部署学习 - IT杂物铺 - 博客园
最新版的欧拉系统不兼容高斯数据库执行安装脚本会错误
[root@localhost script]# ./gs_preinstall -U omm -G dbgrp -L -X /opt/software/openGauss/cluster_config.xml
Traceback (most recent call last):
File "/opt/software/openGauss/script/./gs_preinstall", line 55, in <module>
copy_lib()
File "/opt/software/openGauss/script/gspylib/common/copy_python_lib.py", line 14, in copy_lib
raise Exception("cp file failed.\nError:%s\nThe cmd is: %s\n" %
Exception: cp file failed.
Error:cp: 对 '/opt/software/openGauss/script/gspylib/common/../../../lib/bcrypt/lib3.11/_bcrypt.abi3.so' 调用 stat 失败: No such file or directory
The cmd is: cp /opt/software/openGauss/script/gspylib/common/../../../lib/bcrypt/lib3.11/_bcrypt.abi3.so /opt/software/openGauss/script/gspylib/common/../../../lib/bcrypt/
[root@localhost script]#
欧拉系统下载地址:
https://www.openeuler.org/zh/download/
鲲鹏处理器:下载aarch64链接
系统安装
安装步骤省略,安装完成配置网络开启远程登录,使用root账户
系统安装完毕,配置ip地址,远程登录如下图
高斯数据库安装
官方下载地址:
https://opengauss.org/zh/download/
官方安装文档:
企业版安装 | openGauss文档 | openGauss社区
完整脚本示例
wget https://opengauss.obs.cn-south-1.myhuaweicloud.com/6.0.0/openEuler22.03/arm/openGauss-All-6.0.0-openEuler22.03-aarch64.tar.gz
cat /etc/hostname
yum install tar -y
tar -zxf openGauss-All-6.0.0-openEuler22.03-aarch64.tar.gz
vi cluster_config.xml
mkdir -p /opt/software/openGauss
cd /opt/software/openGauss
tar -zxf ~/openGauss-OM-6.0.0-openEuler22.03-aarch64.tar.gz
cp ~/cluster_config.xml .
chmod 755 -R /opt/software
cd /opt/software/openGauss/script/
./gs_preinstall -U omm -G dbgrp -X /opt/software/openGauss/cluster_config.xml
gs_install -X /opt/software/openGauss/cluster_config.xml
完整操作步骤如下:
远程登录ssh,使用wget下载安装包,并安装tar命令,解压安装包
远程登录ssh后,执行下载安装包
[root@host02 ~]# wget https://opengauss.obs.cn-south-1.myhuaweicloud.com/6.0.0/openEuler22.03/arm/openGauss-All-6.0.0-openEuler22.03-aarch64.tar.gz
--2025-03-26 16:57:11-- https://opengauss.obs.cn-south-1.myhuaweicloud.com/6.0.0/openEuler22.03/arm/openGauss-All-6.0.0-openEuler22.03-aarch64.tar.gz
正在解析主机 opengauss.obs.cn-south-1.myhuaweicloud.com (opengauss.obs.cn-south-1.myhuaweicloud.com)... 121.37.63.47, 139.159.208.236, 139.159.208.234, ...
正在连接 opengauss.obs.cn-south-1.myhuaweicloud.com (opengauss.obs.cn-south-1.myhuaweicloud.com)|121.37.63.47|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:150955515 (144M) [application/gzip]
正在保存至: “openGauss-All-6.0.0-openEuler22.03-aarch64.tar.gz”
openGauss-All-6.0.0-openEuler22.03-aarch64.t 100%[==============================================================================================>] 143.96M 43.7MB/s 用时 3.4s
2025-03-26 16:57:15 (41.9 MB/s) - 已保存 “openGauss-All-6.0.0-openEuler22.03-aarch64.tar.gz” [150955515/150955515])
[root@host02 ~]# yum install tar -y
[root@host02 ~]# ls
anaconda-ks.cfg openGauss-All-6.0.0-openEuler22.03-aarch64.tar.gz
[root@host02 ~]# tar -zxf openGauss-All-6.0.0-openEuler22.03-aarch64.tar.gz
[root@host02 ~]# ls -lh
总用量 290M
-rw-------. 1 root root 1.1K 3月 26 16:44 anaconda-ks.cfg
-rw-r--r--. 1 root root 144M 9月 29 22:17 openGauss-All-6.0.0-openEuler22.03-aarch64.tar.gz
-rw-r-----. 1 root root 0 9月 29 19:47 openGauss-CM-6.0.0-openEuler22.03-aarch64.sha256
-rw-r-----. 1 root root 22M 9月 29 19:47 openGauss-CM-6.0.0-openEuler22.03-aarch64.tar.gz
-rw-r-----. 1 root root 65 9月 29 19:46 openGauss-OM-6.0.0-openEuler22.03-aarch64.sha256
-rw-r-----. 1 root root 23M 9月 29 19:46 openGauss-OM-6.0.0-openEuler22.03-aarch64.tar.gz
-rw-r-----. 1 root root 65 9月 29 19:47 openGauss-Server-6.0.0-openEuler22.03-aarch64.sha256
-rw-r-----. 1 root root 101M 9月 29 19:47 openGauss-Server-6.0.0-openEuler22.03-aarch64.tar.bz2
-rw-------. 1 root root 65 9月 29 19:44 upgrade_sql.sha256
-rw-------. 1 root root 553K 9月 29 19:44 upgrade_sql.tar.gz
[root@host02 ~]#
修改主机名,需要重启后生效
[root@host01 ~]# cat /etc/hostname
host01
[root@host01 ~]#
创建xml配置文件命名为cluster_config.xml,主机名和IP地址修改成自己的
<?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,与数据库节点名称列表一一对应 -->
<!-- 如果用ipv6 替换ipv4地址即可 如:<PARAM name="backIp1s" value="2407:xxxx:xxxx:xxxx:xxxx:xxxx:caa:2335"/> -->
<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 -->
<!-- 用ipv6安装部署时 换上ipv6地址即可,后面xml文件示例也是同样操作 -->
<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>
创建安装目录,解压安装包
[root@host02 ~]# ls -lh
总用量 290M
-rw-------. 1 root root 1.1K 3月 26 16:44 anaconda-ks.cfg
-rw-r--r--. 1 root root 2.1K 3月 26 17:03 cluster_config.xml
-rw-r--r--. 1 root root 144M 9月 29 22:17 openGauss-All-6.0.0-openEuler22.03-aarch64.tar.gz
-rw-r-----. 1 root root 0 9月 29 19:47 openGauss-CM-6.0.0-openEuler22.03-aarch64.sha256
-rw-r-----. 1 root root 22M 9月 29 19:47 openGauss-CM-6.0.0-openEuler22.03-aarch64.tar.gz
-rw-r-----. 1 root root 65 9月 29 19:46 openGauss-OM-6.0.0-openEuler22.03-aarch64.sha256
-rw-r-----. 1 root root 23M 9月 29 19:46 openGauss-OM-6.0.0-openEuler22.03-aarch64.tar.gz
-rw-r-----. 1 root root 65 9月 29 19:47 openGauss-Server-6.0.0-openEuler22.03-aarch64.sha256
-rw-r-----. 1 root root 101M 9月 29 19:47 openGauss-Server-6.0.0-openEuler22.03-aarch64.tar.bz2
-rw-------. 1 root root 65 9月 29 19:44 upgrade_sql.sha256
-rw-------. 1 root root 553K 9月 29 19:44 upgrade_sql.tar.gz
[root@host02 ~]# mkdir -p /opt/software/openGauss
[root@host02 ~]# cd /opt/software/openGauss
[root@host02 openGauss]# tar -zxf ~/openGauss-OM-6.0.0-openEuler22.03-aarch64.tar.gz
[root@host02 openGauss]# cp ~/cluster_config.xml .
[root@host02 openGauss]# ls -lh
总用量 146M
-rw-r--r--. 1 root root 2.1K 3月 26 17:07 cluster_config.xml
drwxr-x---. 19 root root 4.0K 9月 29 19:46 lib
-rw-r-----. 1 root root 0 9月 29 19:47 openGauss-CM-6.0.0-openEuler22.03-aarch64.sha256
-rw-r-----. 1 root root 22M 9月 29 19:47 openGauss-CM-6.0.0-openEuler22.03-aarch64.tar.gz
-rw-r-----. 1 root root 65 9月 29 19:46 openGauss-OM-6.0.0-openEuler22.03-aarch64.sha256
-rw-r-----. 1 root root 23M 9月 29 19:46 openGauss-OM-6.0.0-openEuler22.03-aarch64.tar.gz
-rw-r-----. 1 root root 65 9月 29 19:47 openGauss-Server-6.0.0-openEuler22.03-aarch64.sha256
-rw-r-----. 1 root root 101M 9月 29 19:47 openGauss-Server-6.0.0-openEuler22.03-aarch64.tar.bz2
drwxr-x---. 11 root root 4.0K 9月 29 19:46 script
-rw-------. 1 root root 65 9月 29 19:44 upgrade_sql.sha256
-rw-------. 1 root root 553K 9月 29 19:44 upgrade_sql.tar.gz
-rw-r-----. 1 root root 35 9月 29 19:46 version.cfg
[root@host02 openGauss]#
[root@host02 openGauss]# chmod 755 -R /opt/software
[root@host02 openGauss]# cd /opt/software/openGauss/script
[root@host02 script]# vi /etc/profile.d/performance.sh
[root@host02 script]# [root@host02 script]# hostname
host02
[root@host02 script]# cat /etc/hostname
host02
[root@host02 script]#
执行脚本初始化
[root@host02 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:
Generate cluster user password files successfully.
Successfully created [omm] user on all nodes.
Preparing SSH service.
Successfully prepared SSH service.
Checking OS software.
Successfully check OS software.
Checking OS version.
Successfully checked OS version.
Checking cpu instructions.
Successfully checked cpu instructions.
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 host02 -X /opt/software/openGauss/cluster_config.xml --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.
Successfully set ARM Optimization.
Fixing server package owner.
Setting finish flag.
Successfully set finish flag.
Preinstallation succeeded.
[root@host02 script]#
切换omm用户执行安装
[root@host02 script]# su - omm
上一次登录: 三 3月 26 17:14:02 CST 2025 pts/0 上
Welcome to 5.10.0-216.0.0.115.oe2203sp4.aarch64
System information as of time: 2025年 03月 26日 星期三 17:14:54 CST
System load: 0.01
Memory used: .7%
Swap used: 0%
Usage On: 5%
IP address: 192.168.10.42
Users online: 2
To run a command as administrator(user "root"),use "sudo <command>".
[omm@host02 ~]$ gs_install -X /opt/software/openGauss/cluster_config.xml
Parsing the configuration file.
Successfully checked gs_uninstall on every node.
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/huawei/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@host02 ~]$
安装完毕执行验证
[omm@host02 ~]$ ls -lh /opt/huawei/
总用量 12K
drwxrwxr-x. 2 omm dbgrp 4.0K 3月 26 17:10 corefile
drwxrwxr-x. 5 omm dbgrp 4.0K 3月 26 17:15 install
drwx------. 2 omm dbgrp 4.0K 3月 26 17:16 tmp
[omm@host02 ~]$ gs_om -t status
-----------------------------------------------------------------------
cluster_name : dbCluster02
cluster_state : Normal
redistributing : No
-----------------------------------------------------------------------
[omm@host02 ~]$ gsql -d postgres -p 15400
gsql ((openGauss 6.0.0 build aee4abd5) compiled at 2024-09-29 19:31:41 commit 0 last mr )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.
openGauss=#
启动停止数据库示例脚本
[omm@host02 ~]$ gs_om -t stop
Stopping cluster.
=========================================
Successfully stopped cluster.
=========================================
End stop cluster.
[omm@host02 ~]$ gs_om -t start
Starting cluster.
=========================================
[SUCCESS] host02
2025-03-26 17:18:59.067 67e3c683.1 [unknown] 281472542724128 [unknown] 0 dn_6001 01000 0 [BACKEND] WARNING: could not create any HA TCP/IP sockets
2025-03-26 17:18:59.067 67e3c683.1 [unknown] 281472542724128 [unknown] 0 dn_6001 01000 0 [BACKEND] WARNING: could not create any HA TCP/IP sockets
=========================================
Successfully started.
[omm@host02 ~]$ gs_om -t status
-----------------------------------------------------------------------
cluster_name : dbCluster02
cluster_state : Normal
redistributing : No
-----------------------------------------------------------------------
[omm@host02 ~]$ gsql -d postgres -p 15400
gsql ((openGauss 6.0.0 build aee4abd5) compiled at 2024-09-29 19:31:41 commit 0 last mr )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.
openGauss=#
查看数据库监听端口
netstat -tunlp
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 192.168.10.42:15400 0.0.0.0:* LISTEN 5148/gaussdb
tcp 0 0 127.0.0.1:15400 0.0.0.0:* LISTEN 5148/gaussdb
tcp 0 0 192.168.10.42:15401 0.0.0.0:* LISTEN 5148/gaussdb
tcp 0 0 127.0.0.1:15401 0.0.0.0:* LISTEN 5148/gaussdb
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp6 0 0 ::1:15400 :::* LISTEN 5148/gaussdb
tcp6 0 0 ::1:15401 :::* LISTEN 5148/gaussdb
tcp6 0 0 :::22 :::* LISTEN -
udp 0 0 0.0.0.0:68 0.0.0.0:* -
udp 0 0 127.0.0.1:323 0.0.0.0:* -
udp6 0 0 ::1:323