安装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

OpenGauss是基于PostgreSQL的企业数据库,提供了高性能、安全性以及可扩展性。以下是OpenGauss企业单节点安装的基本步骤,但请注意,实际操作可能需要根据官方文档或最新本的要求进行调整: 1. **准备工作**: - 下载OpenGauss安装包:访问OpenGauss官方网站下载适用于你操作系统和硬件环境的最新本。 - 准备所需的系统配置:包括磁盘空间、内存、网络等。 2. **安装前的环境检查**: - 检查操作系统是否满足OpenGauss的最低要求(比如Linux内核本)。 - 确保所有依赖项(如GCC、Python等)已安装并更新至最新本。 3. **运行安装脚本**: - 使用终端或命令行工具,解压下载的安装包并进入目录。 - 运行`./configure`命令,指定安装路径、数据目录等选项。 ``` ./configure --prefix=/path/to/opengauss --enable-thread-safe ``` 4. **编译和安装**: - 如果一切配置正常,执行`make all`进行编译,然后`make install`完成安装。 ``` make all sudo make install ``` 5. **启动数据库服务**: 安装完成后,你可以使用`pg_ctl`工具启动服务,例如: ``` sudo /usr/local/opengauss/bin/pg_ctl start -D /path/to/opengauss/data ``` 6. **首次运行数据库**: 需要创建管理员用户和初始化数据库,可以使用`createdb`命令: ``` createdb -U postgres template0 psql -U postgres -c "CREATE DATABASE mydatabase;" ``` 7. **配置和管理**: 根据需求,编辑配置文件(如`postgresql.conf`),设置监听地址、日志级别等,并对权限和性能进行调整。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值