OpenGauss 5.0.0企业版在Centos7.5下的安装

目录

📌 官方网址

环境要求

硬件环境

软件环境

安装前准备

关闭防火墙

设置字符集

(可选)关闭swap交换内存

安装环境依赖包

升级Python至3.6.x版本

安装Python所需依赖

此处可能会报错

(可选)设置python的环境变量

下载OpenGauss5.0.0源文件

存放解压OpenGauss源文件,并赋予读写权限

创建dbgrp分组,以及omm用户

创建一个配置文件

(这步应该不用)需要修改系统参数

预安装(使用root账号)

预安装验证

正式安装(使用omm账号)

正式安装验证


📌 官方网址

下载地址: 软件包 | openGauss
安装手册: 企业版安装

环境要求

硬件环境

项目

配置描述

内存

功能调试建议32GB以上。

性能测试和商业部署时,单实例部署建议128GB以上。

复杂的查询对内存的需求量比较高,在高并发场景下,可能出现内存不足。此时建议使用大内存的机器,或使用负载管理限制系统的并发。

CPU

功能调试最小1×8核,2.0GHz。

性能测试和商业部署时,单实例部署建议1×16核,2.0GHz。

CPU超线程和非超线程两种模式都支持。

说明:

目前,openGauss仅支持ARM服务器和基于x86_64通用PC服务器的CPU。

硬盘

用于安装openGauss的硬盘需最少满足如下要求:

  • 至少1GB用于安装openGauss的应用程序。
  • 每个主机需大约300MB用于元数据存储。
  • 预留70%以上的磁盘剩余空间用于数据存储。

建议系统盘配置为RAID1,数据盘配置为RAID5,且规划4组RAID5数据盘用于安装openGauss。有关RAID的配置方法在本手册中不做介绍。请参考硬件厂家的手册或互联网上的方法进行配置,其中Disk Cache Policy一项需要设置为Disabled,否则机器异常掉电后有数据丢失的风险。

openGauss支持使用SSD盘作为数据库的主存储设备,支持SAS接口和NVME协议的SSD盘,以RAID的方式部署使用。

网络要求

300兆以上以太网。

建议网卡设置为双网卡冗余bond。有关网卡冗余bond的配置方法在本手册中不做介绍。请参考硬件厂商的手册或互联网上的方法进行配置。

软件环境

软件类型

配置描述

Linux操作系统

  • ARM:
    • openEuler 20.03LTS(推荐采用此操作系统)
    • openEuler 22.03LTS
    • 麒麟V10
    • Asianux 7.5
  • x86:
    • openEuler 20.03LTS
    • openEuler 22.03LTS
    • CentOS 7.6
    • Asianux 7.6

说明:

当前安装包只能在英文操作系统上安装使用。

Linux文件系统

剩余inode个数 > 15亿(推荐)

工具

bzip2

Python

  • openEuler:支持Python 3.7.X, Python 3.9.X
  • CentOS:支持Python 3.6.X
  • 麒麟:支持Python 3.7.X
  • Asianux:支持Python 3.6.X

说明:

python需要通过--enable-shared方式编译。

若用户修改过系统python版本,则在安装数据库之前,还需手动安装下列python模块(pip安装即可)。

psutil

netifaces

cffi

pycparser

cryptography

pynacl

bcrypt

paramiko

并且在预安装时,需要加上--unused-third-party选项。

安装前准备

关闭防火墙

[root@centos243 ~]# vim /etc/selinux/config
SELINUX=disabled
[root@centos243 ~]# setenforce 0
[root@centos243 ~]# systemctl disable firewalld.service
[root@centos243 ~]# systemctl stop firewalld.service
[root@centos243 ~]# reboot

设置字符集

[root@centos243 ~]# vim /etc/profile
export LANG=zh_CN.utf8
[root@centos243 ~]# source /etc/profile

(可选)关闭swap交换内存

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

安装环境依赖包

//安装环境依赖包
[root@centos243 ~]# yum -y groupinstall "Development tools"
[root@centos243 ~]# yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel libffi-devel

升级Python至3.6.x版本

centos7.5默认python版本为2.7.5,不满足OpenGauss的软件环境要求,故进行升级
//安装python
[root@centos243 ~]# python -V
Python 2.7.5
[root@centos243 ~]# wget https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tar.xz
[root@centos243 ~]# ls
anaconda-ks.cfg  Python-3.6.8.tar.xz
[root@centos243 ~]# mkdir /usr/local/python3
[root@centos243 ~]# xz -d Python-3.6.8.tar.xz
[root@centos243 ~]# tar xf Python-3.6.8.tar -C /usr/local/python3/
[root@centos243 ~]# cd /usr/local/python3/Python-3.6.8/
[root@centos243 Python-3.6.8]# ./configure --prefix=/usr/local/python3/  --enable-optimizations
[root@centos243 Python-3.6.8]# make && make install
//创建软连接
[root@centos243 Python-3.6.8]# ln -sf /usr/local/python3/bin/python3.6 /usr/bin/python3
[root@centos243 Python-3.6.8]# ln -sf /usr/local/python3/bin/pip3 /usr/bin/pip3
//替换原有python文件
[root@centos243 Python-3.6.8]# mv /usr/bin/python /usr/bin/python22
[root@centos243 Python-3.6.8]# ln -sf /usr/bin/python3 /usr/bin/python
//修改配置文件
[root@centos243 Python-3.6.8]# vim /usr/bin/yum
把文件头部的#!/usr/bin/python改成#!/usr/bin/python22
[root@centos243 Python-3.6.8]# vim /usr/libexec/urlgrabber-ext-down
把文件头部的#!/usr/bin/python改成#!/usr/bin/python22
[root@centos243 ~]# python -V
Python 3.6.8

安装Python所需依赖

[root@centos243 ~]# pip3 install psutil netifaces cffi pycparser cryptography pynacl bcrypt paramiko

此处可能会报错

🔔 报错信息如下:

Could not find a version that satisfies the requirement pip3 (from versions: )

No matching distribution found for pip3

You are using pip version 9.0.1, however version 23.3.1 is available.

You should consider upgrading via the 'pip install --upgrade pip' command.

[root@centos243 ~]# pip3 install --upgrade pip
Collecting pip
//重新下载
[root@centos243 ~]# pip3 install psutil netifaces cffi pycparser cryptography pynacl bcrypt paramiko
//下载opengauss依赖
[root@centos243 ~]# yum install -y libaio-devel flex bison ncurses-devel glibc-devel patch redhat-lsb-core readline-devel libnsl

(可选)设置python的环境变量

升级完python版本之后,如果import依赖出现报错:no module named,则需要设置环境变量
//先确保这些依赖已经导入
[root@centos243 Python-3.6.8]# pip3 list
Package      Version
------------ -------
bcrypt       4.0.1
cffi         1.15.1
cryptography 40.0.2
netifaces    0.11.0
paramiko     3.3.1
pip          21.3.1
psutil       5.9.6
pycparser    2.21
PyNaCl       1.5.0
setuptools   59.6.0

// 用root账号,设置全局环境变量
[root@centos243 Python-3.6.8]# vim /etc/profile
export PYTHONPATH=/usr/local/python3/lib/python3.6/site-packages
[root@centos243 Python-3.6.8]# source /etc/profile

下载OpenGauss5.0.0源文件

下载地址: 软件包 | openGauss

存放解压OpenGauss源文件,并赋予读写权限

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

// 创建文件夹
[root@centos243 ~]# mkdir -p /soft/ogs
// 赋予读写权限
[root@centos243 ~]# chmod 755 -R /soft/ogs

2. 将安装包“openGauss-x.x.x-openEuler-64bit-all.tar.gz”上传至上一步所创建的目录中。

3. 在安装包所在的目录下,解压安装包openGauss-x.x.x-openEuler-64bit-all.tar.gz。安装包解压后,会有OM安装包和Server安装包。继续解压OM安装包,会在/soft/ogs路径下自动生成script子目录,并且在script目录下生成gs_preinstall等各种OM工具脚本。

[root@centos243 ~]# cd /soft/ogs
[root@centos243 ogs]# tar -zxvf openGauss-5.0.0-openEuler-64bit-all.tar.gz
[root@centos243 ogs]# tar -zxvf openGauss-5.0.0-openEuler-64bit-om.tar.gz
📌 说明:

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

运行前置脚本gs_preinstall准备安装环境时,脚本内部会自动将openGauss配置文件、解压后的安装包同步拷贝到其余服务器的相同目录下。

在执行前置脚本或者互信前,请检查/etc/profile文件中是否包含错误输出信息,如果存在错误输出,需手动处理。

创建dbgrp分组,以及omm用户

[root@centos243 ~]# groupadd dbgrp
[root@centos243 ~]# useradd -g dbgrp omm
[root@centos243 ~]# passwd omm
// 更改用户 omm 的密码

创建一个配置文件

初始模板文件 ./script/gspylib/etc/conf/cluster_config_template.xml
// 新建一个配置文件
[root@centos243 ogs]# vim /soft/ogs/script/gspylib/etc/conf/config.xml

<?xml version="1.0" encoding="utf-8"?>
<ROOT>
  <!-- openGauss整体信息 -->
  <CLUSTER>
  <!-- 数据库名称 -->
    <PARAM name="clusterName" value="hcdevcluster" />
    <!-- 数据库节点名称(hostname) -->
    <PARAM name="nodeNames" value="centos243"/>
    <PARAM name="gaussdbAppPath" value="/soft/huawei/install/app" />
    <PARAM name="gaussdbLogPath" value="/var/log/omm" />
    <PARAM name="tmpMppdbPath" value="/soft/huawei/tmp"/>
    <PARAM name="gaussdbToolPath" value="/soft/huawei/install/om" />
    <PARAM name="corePath" value="/soft/huawei/corefile"/>
    <PARAM name="backIp1s" value="192.168.1.243"/>
  </CLUSTER>
  
  <DEVICELIST>
    <DEVICE sn="node1">
      <PARAM name="name" value="centos243"/>
      <PARAM name="azName" value="AZ1"/>
      <PARAM name="azPriority" value="1"/>
      <!-- 节点1的IP,如果服务器只有一个网卡可用,将backIP1和sshIP1配置成同一个IP -->
      <PARAM name="backIp1" value="192.168.1.243"/>
      <PARAM name="sshIp1" value="192.168.1.243"/>
      <!-- dn -->
      <PARAM name="dataNum" value="1"/>
      <PARAM name="dataPortBase" value="15400"/>
      <PARAM name="dataNode1" value="/soft/huawei/install/data/dn"/>
      <PARAM name="dataNode1_syncNum" value="0"/>
    </DEVICE>

  </DEVICELIST>
</ROOT>
📌 注意!!!

那两个箭头所指的name要保持一致,且值为你的主机名hostname,不然他会报错,会报你的主机名不在这个集群。然后红框框起来的里面的路径,千万千万不能在openGauss源文件路径下,不然会有各种权限错误,这里的huawei目录与openGauss源文件目录在一个根目录底下且平级,且日志路径最好跟我一致。然后可以不用提前创建这些文件夹,因为后面执行脚本的时候会自动创建这些目录。

我的源文件路径:/soft/ogs

我的配置路径:/soft/huawei/xxx

我的日志路径:/var/log/omm

(这步应该不用)需要修改系统参数

执行预安装前请加载安装包中 lib 库

[root@centos243 ogs]# vim /etc/profile
export LD_LIBRARY_PATH=/soft/ogs/script/gspylib/clib
[root@centos243 ogs]# source /etc/profile

预安装(使用root账号)

必须使用root账号进行操作

[root@centos243 ogs]# cd /soft/ogs/script
[root@centos243 script]# ./gs_preinstall -U omm -G dbgrp -X /soft/ogs/script/gspylib/etc/conf/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.
Are you sure you want to create trust for root (yes/no)? yes
Please enter password for root.
Password:
Creating SSH trust for the root permission user.
Checking network information.
All nodes in the network are Normal.
Successfully checked network information.
Creating SSH trust.
Creating the local key file.
Successfully created the local key files.
Appending local ID to authorized_keys.
Successfully appended local ID to authorized_keys.
Updating the known_hosts file.
Successfully updated the known_hosts file.
Appending authorized_key on the remote node.
Successfully appended authorized_key on all remote node.
Checking common authentication file content.
Successfully checked common authentication content.
Distributing SSH trust file to all node.
Successfully distributed SSH trust file to all node.
Verifying SSH trust on all hosts.
Successfully verified SSH trust on all hosts.
Successfully created SSH trust.
Successfully created SSH trust for the root permission user.
Setting pssh path
Successfully set core path.
Distributing package.
Begin to distribute package to tool path.
Successfully distribute package to tool path.
Begin to distribute package to package path.
Successfully distribute package to package path.
Successfully distributed package.
Are you sure you want to create the user[omm] and create trust for it (yes/no)? yes
Please enter password for cluster user.
Password:
Please enter password for cluster user again.
Password:
Successfully created [omm] user on all nodes.
Preparing SSH service.
Successfully prepared SSH service.
Installing the tools in the cluster.
Successfully installed the tools in the cluster.
Checking hostname mapping.
Successfully checked hostname mapping.
Creating SSH trust for [omm] user.
Checking network information.
All nodes in the network are Normal.
Successfully checked network information.
Creating SSH trust.
Creating the local key file.
Successfully created the local key files.
Appending local ID to authorized_keys.
Successfully appended local ID to authorized_keys.
Updating the known_hosts file.
Successfully updated the known_hosts file.
Appending authorized_key on the remote node.
Successfully appended authorized_key on all remote node.
Checking common authentication file content.
Successfully checked common authentication content.
Distributing SSH trust file to all node.
Successfully distributed SSH trust file to all node.
Verifying SSH trust on all hosts.
Successfully verified SSH trust on all hosts.
Successfully created SSH trust.
Successfully created SSH trust for [omm] user.
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.
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.
Set ARM Optimization.
No need to set ARM Optimization.
Fixing server package owner.
Setting finish flag.
Successfully set finish flag.
PreInstallationGuide succeeded.

预安装验证

1. 通过 openGauss 提供的 gs_checkos 工具可以完成系统状态检查。

◾ 以 root 用户身份登录。

◾ 执行如下命令对 openGauss 节点服务器的 OS 参数进行检查。

[root@centos243 script]# gs_checkos -i A
Checking items:
    A1. [ OS version status ]                                   : Normal
    A2. [ Kernel version status ]                               : Normal
    A3. [ Unicode status ]                                      : Normal
    A4. [ Time zone status ]                                    : Normal
    A5. [ Swap memory status ]                                  : Normal
    A6. [ System control parameters status ]                    : Warning
    A7. [ File system configuration status ]                    : Normal
    A8. [ Disk configuration status ]                           : Normal
    A9. [ Pre-read block size status ]                          : Normal
    A11.[ Network card configuration status ]                   : Warning
    A12.[ Time consistency status ]                             : Warning
    A13.[ Firewall service status ]                             : Normal
    A14.[ THP service status ]                                  : Normal
Total numbers:13. Abnormal numbers:0. Warning numbers:3.

2. 查看安装路径下是否写入依赖包。

正式安装(使用omm账号)

  • /soft/ogs/script/gspylib/etc/conf/config.xml为openGauss配置文件的路径。
  • 在执行过程中,用户需根据提示输入数据库的密码,密码具有一定的复杂度,为保证用户正常使用该数据库,请记住输入的数据库密码。
  • 设置的密码要符合复杂度要求:
    最少包含8个字符,最多包含16个字符。
    不能和用户名、当前密码(ALTER)、或当前密码反序相同。
    至少包含大写字母(A-Z)、小写字母(a-z)、数字、非字母数字字符(限定为~!@#$%^&*()-_=+\|[{}];:,<.>/?)四类字符中的三类字符。
  • 安装过程中会生成ssl证书,证书存放路径为{gaussdbAppPath}/share/sslcert/om,其中{gaussdbAppPath}为openGauss配置文件中指定的程序安装目录。
  • 日志文件路径下会生成两个日志文件:“gs_install-YYYY-MMDD_HHMMSS.log”和“gs_local-YYYY-MM-DD_HHMMSS.log”。
// 使用root账号,给omm账号授权
[root@centos243 ogs]# chown -R omm.dbgrp /soft/huawei/
[root@centos243 ogs]# chown -R omm.dbgrp /soft/ogs/
// 切换到omm账号
[root@centos243 ogs]# su omm
[root@centos243 ogs]# cd script
[omm@centos243 script]# ./gs_install -X /soft/ogs/script/gspylib/etc/conf/config.xml

正式安装验证

以omm用户身份登录服务器。

执行如下命令检查数据库状态是否正常,“cluster_state ”显示“Normal”表示数据库可正常使用。

gs_om -t status

数据库安装完成后,默认生成名称为postgres的数据库。第一次连接数据库时可以连接到此数据库。

其中postgres为需要连接的数据库名称,15400为数据库主节点的端口号,即XML配置文件中的dataPortBase的值。请根据实际情况替换。

gsql -d postgres -p15400

连接成功后,系统显示类似如下信息表示数据库连接成功。

gsql ((openGauss x.x.x build 290d125f) compiled at 2021-03-08 02:59:43 commit 2143 last mr 131
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type"help"forhelp.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值