百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
O

openGauss-server

> 编程语言
开源

openGauss 内核

783 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

openGauss 内核

English | 简体中文

  • 什么是openGauss
  • 安装
    • 创建配置文件
    • 初始化安装环境
    • 执行安装
    • 卸载openGauss
      • 执行卸载
      • 一键式环境清理
  • 编译
    • 概述
    • 操作系统和软件依赖要求
    • 下载openGauss
    • 编译第三方软件
    • 代码编译
      • 使用build.sh编译代码
      • 使用命令编译代码
    • 编译安装包
    • 运行Fastcheck
  • 快速入门
  • 文档
  • 社区
    • 治理
    • 交流
  • 贡献
  • 发行说明
  • 许可证

什么是openGauss

openGauss是一款开源的关系型数据库管理系统,它具有多核高性能、全链路安全性、智能运维等企业级特性。 openGauss凝聚了华为在数据库领域多年的内核经验,在架构、事务、存储引擎、优化器及ARM架构上进行了适配与优化。作为一个开源数据库,期望与广泛的开发者共同构建一个多元化技术的开源数据库社区。

高性能

openGauss突破了多核CPU的瓶颈,实现两路鲲鹏128核150万tpmC,内存优化表(MOT)引擎达350万tpmC。

数据分区

内部线程共享的关键数据结构进行数据分区,减少加锁访问冲突。比如CLOG就采用分区优化,解决ClogControlLock锁瓶颈。

NUMA化内核数据结构

关键数据结构NUMA化分配,减少跨CPU访问。比如全局PGPROC数组按照NUMA Node的数目分为多份,分别在对应NUMA Node上申请内存。解决ProcArrayLock锁瓶颈。

绑核优化

把网络中断绑核和后台业务线程绑核区分开,避免运行线程在核间迁移造成的性能不稳定。

ARM指令优化

结合ARM平台的原子操作lse进行优化,实现关键互斥变量原子高效操作。

SQL BY PASS

通过SQL BY PASS优化SQL执行流程,简化CPU执行开销。

高可靠

正常业务负载情况下,RTO小于10秒,降低节点故障导致的业务不可用时间。

并行恢复

主机日志传输到备机时,备机日志落盘的同时,发送给重做恢复分发线程,分发线程根据日志类型和日志操作的数据页发给多个并行恢复线程进行日志重做,保证备机的重做速度跟上主机日志的产生速度。这样备机实时处于ready状态,从而实现瞬间故障切换。

MOT引擎(Beta发布)

内存优化表(MOT)存储引擎是一个专为多核大内存优化的存储引擎,具有极高的联机事务处理(OLTP)性能和资源利用率。MOT的数据和索引完全存储在内存中,通过NUMA感知执行,算法消除闩锁争用以及查询JIT本地编译,提供低时延数据访问及高效事务执行。更多请参考MOT引擎文档。

安全

openGauss支持账号管理,账号认证,口令复杂度检查,账号锁定,权限管理和校验,传输加密,操作 审计等全方位的数据库安全能力,保护业务满足安全要求。

易运维

openGauss将AI算法集成到数据库中,减少数据库维护的负担。

  • SQL预测

openGauss根据收集的历史性能数据进行编码和基于深度学习的训练及预测,支持SQL执行时间预测。

  • SQL诊断器

openGauss支持SQL执行语句的诊断器,提前发现慢查询。

  • 参数自动调整

openGauss通过机器学习方法自动调整数据库参数,提高调参效率,降低正确调参成本。

安装

创建配置文件

在安装openGauss之前,需要创建clusterconfig.xml配置文件。XML文件包含部署openGauss的服务器信息、安装路径、IP地址以及端口号等。用于告知openGauss如何部署。用户需根据不同场配置对应的XML文件。

下面以一主一备的部署方案为例,说明如何创建XML配置文件。 以下value取值信息仅为示例,可自行替换。每行信息均有注释进行说明。


    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
    
    
        
        
        
            
        
            
            
        
            
            
            
	    
	    	
	    
	    	
	    
	    	
	    
	    	
        

        
        
            
            
            
            
            
            
	
    

初始化安装环境

创建完openGauss配置文件后,在执行安装前,为了后续能以最小权限进行安装及openGauss管理操作,保证系统安全性,需要运行安装前置脚本gs_preinstall准备好安装用户及环境。

安装前置脚本gs_preinstall可以协助用户自动完成如下的安装环境准备工作:

  • 自动设置Linux内核参数以达到提高服务器负载能力的目的。这些参数直接影响数据库系统的运行状态,请仅在确认必要时调整。
  • 自动将openGauss配置文件、安装包拷贝到openGauss主机的相同目录下。
  • openGauss安装用户、用户组不存在时,自动创建安装用户以及用户组。
  • 读取openGauss配置文件中的目录信息并创建,将目录权限授予安装用户。

注意事项

  • 用户需要检查上层目录权限,保证安装用户对安装包和配置文件目录读写执行的权限。
  • xml文件中各主机的名称与IP映射配置正确。
  • 只能使用root用户执行gs_preinstall命令。

操作步骤

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

    mkdir -p /opt/software/openGauss
    chmod 755 -R /opt/software
    

    说明

    • 不建议把安装包的存放目录规划到openGauss用户的家目录或其子目录下,可能导致权限问题。
    • openGauss用户须具有/opt/software/openGauss目录的读写权限。
  2. 将安装包“openGauss-x.x.x-openEULER-64bit.tar.gz”和配置文件“clusterconfig.xml”都上传至上一步所创建的目录中。

  3. 在安装包所在的目录下,解压安装包openGauss-x.x.x-openEULER-64bit.tar.gz。安装包解压后,在/opt/software/openGauss目录下自动生成script目录。在script目录下生成gs_preinstall等OM工具脚本。

    cd /opt/software/openGauss
    tar -zxvf openGauss-x.x.x-openEULER-64bit.tar.gz
    
  4. 进入工具脚本目录。

    cd /opt/software/openGauss/script
    
  5. 如果是openEuler的操作系统,执行如下命令打开performance.sh文件,用#注释sysctl -w vm.min_free_kbytes=112640 &> /dev/null,键入“ESC”键进入指令模式,执行 :wq保存并退出修改。

    vi /etc/profile.d/performance.sh
    
  6. 为确保openssl版本正确,执行预安装前请加载安装包中lib库。执行命令如下,其中 {packagePath} 为用户安装包放置的路径,本示例中为/opt/software/openGauss。

    export LD_LIBRARY_PATH={packagePath}/script/gspylib/clib:$LD_LIBRARY_PATH
    
  7. 为确保成功安装,检查 hostname 与 /etc/hostname 是否一致。预安装过程中,会对hostname进行检查。

  8. 使用gs_preinstall准备好安装环境。若为共用环境需加入--sep-env-file=ENVFILE参数分离环境变量,避免与其他用户相互影响,ENVFILE为用户自行指定的环境变量分离文件的路径。

    执行如下命令,即采用交互模式执行前置,并在执行过程中自动创建root用户互信和openGauss用户互信:

    ./gs_preinstall -U omm -G dbgrp -X /opt/software/openGauss/clusterconfig.xml
    

    omm为数据库管理员用户(即运行openGauss的操作系统用户),dbgrp为运行openGauss的操作系统用户的组名,/opt/software/ openGauss/clusterconfig.xml为openGauss的配置文件路径。执行过程中需要根据提示选择建立互信,并输入root或openGauss用户的密码。

执行安装

执行前置脚本准备好openGauss安装环境之后,按照启动安装过程部署openGauss。

前提条件

  • 已成功执行前置脚本gs_preinstall。
  • 所有服务器操作系统和网络均正常运行。
  • 用户需确保各个主机上的locale保持一致。

操作步骤

  1. (可选)检查安装包和openGauss配置文件在规划路径下是否已存在,如果没有,重新执行预安装,确保预安装成功,再执行以下步骤。

  2. 登录到openGauss的主机,并切换到omm用户。

    su - omm
    

    说明

    • omm为gs_preinstall脚本中-U参数指定的用户。
    • 以上述omm用户执行gs_install脚本。否则会报执行错误。
  3. 使用gs_install安装openGauss。若为环境变量分离的模式安装的集群需要source环境变量分离文件ENVFILE。

    gs_install -X /opt/software/openGauss/clusterconfig.xml
    

    /opt/software/openGauss/script/clusterconfig.xml为openGauss配置文件的路径。在执行过程中,用户需根据提示输入数据库的密码,密码具有一定的复杂度,为保证用户正常使用该数据库,请记住输入的数据库密码。

    密码复杂度要求:

    • 长度至少8个字符。
    • 不能和用户名、当前密码(ALTER)、当前密码的倒序相同。
    • 以下至少包含三类:大写字母(A - Z)、小写字母(a - z)、数字(0 - 9)、其他字符(仅限~!@#$%^&*()-_=+|[{}];:,/?)。
  4. 安装执行成功之后,需要手动删除主机root用户的互信,即删除openGauss数据库各节点上的互信文件。

    rm -rf ~/.ssh
    

卸载openGauss

卸载openGauss的过程包括卸载openGauss和清理openGauss服务器环境。

执行卸载

openGauss提供了卸载脚本,帮助用户卸载openGauss。

操作步骤

  1. 以操作系统用户omm登录数据库主节点。

  2. 使用gs_uninstall卸载openGauss。

    gs_uninstall --delete-data
    

    或者在openGauss中每个节点执行本地卸载。

    gs_uninstall --delete-data -L
    

一键式环境清理

在openGauss卸载完成后,如果不需要在环境上重新部署openGauss,可以运行脚本gs_postuninstall对openGauss服务器上环境信息做清理。openGauss环境清理是对环境准备脚本gs_preinstall所做设置的清理。 前提条件

  • openGauss卸载执行成功。
  • root用户互信可用。
  • 只能使用root用户执行gs_postuninstall命令。

操作步骤

  1. 以root用户登录openGauss服务器。

  2. 查看互信是否建成功,可以互相执行ssh 主机名。输入exit退出。

    plat1:~ # ssh plat2 
    Last login: Tue Jan  5 10:28:18 2016 from plat1 
    plat2:~ # exit 
    logout 
    Connection to plat2 closed. 
    plat1:~ #
    
  3. 进入script路径下。

    cd /opt/software/openGauss/script
    
  4. 使用gs_postuninstall进行清理。若为环境变量分离的模式安装的集群需要source环境变量分离文件ENVFILE。

    ./gs_postuninstall -U omm -X /opt/software/openGauss/clusterconfig.xml --delete-user --delete-group
    

    或者在openGauss中每个节点执行本地后置清理。

    ./gs_postuninstall -U omm -X /opt/software/openGauss/clusterconfig.xml --delete-user --delete-group -L
    

    omm为运行openGauss的操作系统用户名,/opt/software/openGauss/clusterconfig.xml为openGauss配置文件路径。

  5. 删除各openGauss数据库节点root用户互信。

编译

概述

编译openGauss需要openGauss-server和binarylibs两个组件。

  • openGauss-server:openGauss的主要代码。可以从开源社区获取。

  • binarylibs:openGauss依赖的第三方开源软件,你可以直接编译openGauss-third_party代码获取,也可以从开源社区下载已经编译好的并上传的一个副本。

对于数据库、三方库、GCC的编译以及常见问题,参照博客openGauss数据库编译指导

在编译openGauss之前,请检查操作系统和软件依赖要求。

openGauss可以通过一键式shell工具build.sh进行编译,也可以通过命令进行编译。安装包由build.sh生成。

操作系统和软件依赖要求

openGauss支持以下操作系统:

  • CentOS 7.6(x86架构)

  • openEuler-20.03-LTS(aarch64架构)

  • openEuler-20.03-LTS(x86_64架构)

  • openEuler-22.03-LTS(aarch64架构)

  • openEuler-22.03-LTS(x86_64架构)

  • openEuler-24.03-LTS(aarch64架构)

  • openEuler-24.03-LTS(x86_64架构)

PS:在openEuler-24.03上编译openGauss 建议使用cmake版本为3.19

适配其他系统,参照博客openGauss数据库编译指导

以下表格列举了编译openGauss的软件要求。

建议使用从列出的操作系统安装盘或安装源中获取的以下依赖软件的默认安装包进行安装。如果不存在以下软件,请参考推荐的软件版本。

软件依赖要求如下:

软件 推荐版本
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
lsb_release 4.1
readline-devel 7.0-13
libedit-devel 3.0-3.1
libxml2-devel 2.9.1-2.11.5
lz4-devel 1.8.3-1.9.4
numactl-devel 2.0.12-2.0.16
unixODBC-devel 2.3.1-2.3.9
java-1.8.0-openjdk-devel 1.8
openblas-devel 0.3.3及以上
which 2.21
python3 3.6及以上
binutils 2.27及以上
注意:
openblas-devel的头文件安装在/usr/include下,一般是默认路径
yum install libaio-devel flex bison ncurses-devel glibc-devel patch readline-devel libedit-devel libxml2-devel lz4-devel numactl-devel unixODBC-devel java-1.8.0-openjdk-devel openblas-devel which python3 binutils
### centos中安装lsb_release
yum install redhat-lsb-core
### centos中安装openblas-devel
yum install epel-release
yum install openblas-devel
### openEuler安装lsb_release
yum install dkms
# openEuler默认将lsb_release安装在/usr/lib/dkms路径下,可通过建立软链接的形式实现命令直接调用
ln -s /usr/lib/dkms/lsb_release /usr/bin/lsb_release

下载openGauss

可以从开源社区下载openGauss-server和openGauss-third_party。

https://opengauss.org/zh/

可以通过以下网站获取编译好的binarylibs。下载后请解压缩并重命名为binarylibs。

各版本和分支对应编译好的三方库二进制地址如下:

	分支
    tag
    gcc版本
    下载路径




	1.0.0
    v1.0.0
    gcc7.3
    https://opengauss.obs.cn-south-1.myhuaweicloud.com/1.0.0/openGauss-third_party_binarylibs.tar.gz

v1.0.1

	1.1.0
    v1.1.0
    gcc7.3
    https://opengauss.obs.cn-south-1.myhuaweicloud.com/1.1.0/openGauss-third_party_binarylibs.tar.gz




	2.0.0
    v2.0.0
    gcc7.3
    https://opengauss.obs.cn-south-1.myhuaweicloud.com/2.0.0/openGauss-third_party_binarylibs.tar.gz

v2.0.1

v2.0.2

v2.0.3

v2.0.4

v2.0.5

    2.1.0
    v2.1.0
    gcc7.3
    https://opengauss.obs.cn-south-1.myhuaweicloud.com/2.1.0/openGauss-third_party_binarylibs.tar.gz




    3.0.0
    v3.0.0
    gcc7.3
    https://opengauss.obs.cn-south-1.myhuaweicloud.com/3.0.0/openGauss-third_party_binarylibs.tar.gz

v3.0.1

v3.0.2

v3.0.3

        openEuler_arm: https://opengauss.obs.cn-south-1.myhuaweicloud.com/3.0.0/binarylibs/openGauss-third_party_binarylibs_openEuler_arm-3.0.3.tar.gz 

        openEuler_x86: https://opengauss.obs.cn-south-1.myhuaweicloud.com/3.0.0/binarylibs/openGauss-third_party_binarylibs_openEuler_x86_64-3.0.3.tar.gz

        Centos_x86: https://opengauss.obs.cn-south-1.myhuaweicloud.com/3.0.0/binarylibs/openGauss-third_party_binarylibs_Centos7.6_x86_64-3.0.3.tar.gz

    



    3.1.0
    v3.1.0
    gcc7.3
    
       openEuler_arm: https://opengauss.obs.cn-south-1.myhuaweicloud.com/3.1.0/binarylibs/openGauss-third_party_binarylibs_openEuler_arm.tar.gz

        openEuler_x86: https://opengauss.obs.cn-south-1.myhuaweicloud.com/3.1.0/binarylibs/openGauss-third_party_binarylibs_openEuler_x86_64.tar.gz

        Centos_x86: https://opengauss.obs.cn-south-1.myhuaweicloud.com/3.1.0/binarylibs/openGauss-third_party_binarylibs_Centos7.6_x86_64.tar.gz

v3.1.1

    5.0.0
    v5.0.0
    gcc7.3
    
        openEuler 20.03 arm: https://opengauss.obs.cn-south-1.myhuaweicloud.com/5.0.0/binarylibs/openGauss-third_party_binarylibs_openEuler_arm.tar.gz

        openEuler 20.03 x86: https://opengauss.obs.cn-south-1.myhuaweicloud.com/5.0.0/binarylibs/openGauss-third_party_binarylibs_openEuler_x86_64.tar.gz

        Centos_x86: https://opengauss.obs.cn-south-1.myhuaweicloud.com/5.0.0/binarylibs/openGauss-third_party_binarylibs_Centos7.6_x86_64.tar.gz

        openEuler 22.03 arm: https://opengauss.obs.cn-south-1.myhuaweicloud.com/5.0.0/binarylibs_2203/openGauss-third_party_binarylibs_openEuler_2203_arm.tar.gz

        openEuler 22.03 x8

Issues· 4 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C++

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言