[转帖]openGauss 3.0 单节点安装部署

opengauss,节点,安装,部署 · 浏览次数 : 0

小编点评

| Key | Status | Description | |---|---|---| | A11 | Warning | Network card configuration status is NULL. | | A12 | Warning | NTPD is not detected on the machine and local time is "2022-11-27 18:32:37". | | A13 | Normal | Firewall service is stopped. | | A14 | Normal | THP service is stopped. | | A15 | Normal | All instances are in normal state. | | A16 | Success | Database installation and configuration is completed. | | A17 | Success | One-click environment cleanup is completed. | | A18 | Success | Remove all remaining installation and configuration files. |

正文

https://www.modb.pro/db/568455?utm_source=index_ori

 

openGauss来源于PostgreSQL 9.2.4
pg使用c实现,gs使用c++实现
一个实例多个库

单机HA不是支持一主一备,提供高可靠和读扩展,备机最多8套。

主备部署模块说明:
OM运维管理模块:提供日常运维、配置管理接口,工具在企业版中有,容器和精简安装没有
客户端驱动:Client Driver负责接受应用访问请求。并返回结果集。
openGauss主备:Datanode负责存储业务数据、执行查询任务及向客户端返回执行结果。
3.0开始有集群管理软件CM,管理多个节点主备切换。

下载路径:
软件包 (opengauss.org)

安装环境:
Centos 7.9
openGauss 3.0.0

安装依赖包

yum install -y java-1.8.0-openjdk* psmisc bzip2 python3 python3-devel lksctp*
yum install -y libaio-devel flex bison ncurses-devel glibc-devel patch redhat-lsb-core

配置/etc/hosts主机名
万兆网卡设置backupIP网卡的MTU值(建议默认1500)

vi /etc/sysconfig/network-scripts/ifcfg-ens34
MTU=8192 ## 可能需要网络工程师协助修改网络设备端口MTU配置,万兆

关闭SELINUX和防火墙

vi /etc/selinux/config
--------------------------- 
SELINUX=disabled
---------------------------

systemctl status firewalld
systemctl disable firewalld.service
systemctl stop firewalld.service

配置用户变量

vi ~/.bash_profile
--------------------------- 
export LANG=en_US.UTF-8
--------------------------- 
source ~/.bash_profile
禁用RemoveIPC(openEuler环境)
vi /etc/systemd/logind.conf 
------------------ 
RemoveIPC=no
------------------ 
vi /usr/lib/systemd/system/systemd-logind.service
------------------ 
RemoveIPC=no
----------------- 
systemctl daemon-reload
systemctl restart systemd-logind

关闭swap

vi /etc/fstab ## 注释掉swap分区挂载
swapoff -a ## 关闭swap

关闭透明页[Only for CentOS]

## 临时关闭透明页
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/defrag

## 编译grub,内核层面关闭透明页
sed -i '/^GRUB_CMDLINE_LINUX/d' /etc/default/grub

echo "GRUB_CMDLINE_LINUX=\"rhgb quiet transparent_hugepage=never\"" >> /etc/default/grub

grub2-mkconfig -o /boot/grub2/grub.cfg

时区配置

[root@db1 ~]# ll /etc/localtime
lrwxrwxrwx. 1 root root 35 Apr 27 22:06 /etc/localtime -> ../usr/share/zoneinfo/Asia/Shanghai
#如果时区不正确,则重新创建时区模板的软链接为/etc/localtime(此处以上海时间为例)
[root@db1 ~]# rm -fr /etc/localtime
[root@db1 ~]# ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

系统资源限制

echo "* soft stack 3072" >> /etc/security/limits.conf
echo "* hard stack 3072" >> /etc/security/limits.conf
echo "* soft nofile 1000000" >> /etc/security/limits.conf
echo "* hard nofile 1000000" >> /etc/security/limits.conf
echo "* soft nproc unlimited" >> /etc/security/limits.d/90-nproc.conf
tail -n 4 /etc/security/limits.conf
tail -n 1 /etc/security/limits.d/90-nproc.conf

系统内核参数配置

#####手动修改值
cat >> /etc/sysctl.conf << EOF
net.ipv4.tcp_retries1 = 5
net.ipv4.tcp_syn_retries = 5
net.sctp.path_max_retrans = 10
net.sctp.max_init_retransmits = 10
net.ipv4.tcp_fin_timeout = 60
EOF
#sysctl -p

########脚本自动修改的值如下:
net.ipv4.tcp_max_tw_buckets = 10000
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_keepalive_time = 30
net.ipv4.tcp_keepalive_intvl = 30
net.ipv4.tcp_retries2 = 12
net.ipv4.ip_local_reserved_ports = 20050-20057,26000-26007
net.core.wmem_max = 21299200
net.core.rmem_max = 21299200
net.core.wmem_default = 21299200
net.core.rmem_default = 21299200
kernel.sem = 250 6400000 1000 25600
net.ipv4.tcp_rmem = 8192 250000 16777216
net.ipv4.tcp_wmem = 8192 250000 16777216
vm.min_free_kbytes = 399514
net.core.netdev_max_backlog = 65535
net.ipv4.tcp_max_syn_backlog = 65535
net.core.somaxconn = 65535
kernel.shmall = 1152921504606846720
kernel.shmmax = 18446744073709551615

创建目录并解压安装包

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

3.0
tar -zxvf openGauss-3.0.0-CentOS-64bit-all.tar.gz
tar -zxvf openGauss-3.0.0-CentOS-64bit-om.tar.gz

单实例安装配置XML配置文件(类似oracle静默安装配置文件)
该文件包含部署openGauss的服务器信息、安装路径、IP地址以及端口号等,用于告知openGauss如何部署。
更多配置详细见:创建 Xml配置文件 (opengauss.org)
多节点模板路径:/opt/software/openGauss/script/gspylib/etc/conf/cluster_config_template.xml(3.1)
–单节点单节点配置文件:

vi /opt/software/openGauss/clusterconfig.xml
<?xml version="1.0" encoding="UTF-8"?>
<ROOT>
    <!-- openGauss整体信息 -->
    <CLUSTER>
        <!-- 数据库名称 -->
        <PARAM name="clusterName" value="syc" />
        <!-- 数据库节点名称(hostname) -->
        <PARAM name="nodeNames" value="dbtestenv" />
        <!-- 数据库安装目录-->
        <PARAM name="gaussdbAppPath" value="/opengauss/install/app" />
        <!-- 日志目录-->
        <PARAM name="gaussdbLogPath" value="/opengauss/omm" />
        <!-- 临时文件目录-->
        <PARAM name="tmpMppdbPath" value="/opengauss/tmp" />
        <!-- 数据库工具目录-->
        <PARAM name="gaussdbToolPath" value="/opengauss/install/om" />
        <!-- 数据库core文件目录-->
        <PARAM name="corePath" value="/opengauss/corefile" />
        <!-- 节点IP,与数据库节点名称列表一一对应 -->
        <PARAM name="backIp1s" value="192.168.56.50"/> 
    </CLUSTER>
    <!-- 每台服务器上的节点部署信息 -->
    <DEVICELIST>
        <!-- 节点1上的部署信息 -->
        <DEVICE sn="node1_hostname">
            <!-- 节点1的主机名称 -->
            <PARAM name="name" value="dbtestenv"/>
            <!-- 节点1所在的AZ及AZ优先级 -->
            <PARAM name="azName" value="AZ1"/>
            <PARAM name="azPriority" value="1"/>
            <!-- 节点1的IP,如果服务器只有一个网卡可用,将backIP1和sshIP1配置成同一个IP -->
            <PARAM name="backIp1" value="192.168.56.50"/>
            <PARAM name="sshIp1" value="192.168.56.50"/>
               
    <!--dbnode-->
    <PARAM name="dataNum" value="1"/>
    <PARAM name="dataPortBase" value="15400"/>
    <PARAM name="dataNode1" value="/opengauss/install/data/dn01"/>
            <PARAM name="dataNode1_syncNum" value="0"/>
        </DEVICE>
    </DEVICELIST>
</ROOT>

执行安装前检查

cat>> /etc/profile<<EOF
export LD_LIBRARY_PATH=/opt/software/openGauss/script/gspylib/clib:$LD_LIBRARY_PATH
export PGDATA=/opengauss/install/data/dn01
EOF
cd /opt/software/openGauss/script
./gs_preinstall -U omm -G dbgrp -X /opt/software/openGauss/clusterconfig.xml 

[root@dbtestenv script]# ./gs_preinstall -U omm -G dbgrp -X /opt/software/openGauss/clusterconfig.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/openGauss/script/gs_checkos -i A -h dbtestenv --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.
------------------

查看具体的检查信息(可选):

/opt/software/openGauss/script/gs_checkos -i A -h dbtestenv --detail
--------------------
Checking items:
    A1. [ OS version status ]                                   : Normal     
        [dbtestenv]
        centos_7.9.2009_64bit
         
    A2. [ Kernel version status ]                               : Normal     
        The names about all kernel versions are same. The value is "3.10.0-1160.el7.x86_64".
    A3. [ Unicode status ]                                      : Normal     
        The values of all unicode are same. The value is "LANG=en_US.UTF-8".
    A4. [ Time zone status ]                                    : Normal     
        The informations about all timezones are same. The value is "+0800".
    A5. [ Swap memory status ]                                  : Normal     
        The value about swap memory is correct.            
    A6. [ System control parameters status ]                    : Normal     
        All values about system control  parameters are correct.
    A7. [ File system configuration status ]                    : Normal     
        Both soft nofile and hard nofile are correct.      
    A8. [ Disk configuration status ]                           : Normal     
        The value about XFS mount parameters is correct.   
    A9. [ Pre-read block size status ]                          : Normal     
        The value about Logical block size is correct.     
    A10.[ IO scheduler status ]                                 : Normal     
        The value of IO scheduler is correct.              
    A11.[ Network card configuration status ]                   : Warning    
        [dbtestenv]
BondMode Null
        Warning reason: network 'enp0s3' 'mtu' RealValue '1500' ExpectedValue '8192'

    A12.[ Time consistency status ]                             : Warning    
        [dbtestenv]
        The NTPD not detected on machine and local time is "2022-11-27 18:32:37".

    A13.[ Firewall service status ]                             : Normal     
        The firewall service is stopped.                   
    A14.[ THP service status ]                                  : Normal     
        The THP service is stopped.                        
Total numbers:14. Abnormal numbers:0. Warning numbers:2.
--------------------

执行数据库安装
修改目录权限

cd /opt/software/openGauss/script
chmod -R 755 /opt/software/openGauss/script
chown -R omm:dbgrp /opt/software/openGauss/script

执行数据库安装脚本

# su - omm
$ cd /opt/software/openGauss/script
$ cp ../clusterconfig.xml . 
$ gs_install -X /opt/software/openGauss/script/clusterconfig.xml

安装同时配置实例参数(可选)

su - omm
cd /opt/software/openGauss/script
gs_install -X /opt/software/openGauss/script/clusterconfig.xml \
--gsinit-parameter="--encoding=UTF8" \
--dn-guc="max_connections=5000" \
--dn-guc="max_process_memory=2GB" \
--dn-guc="shared_buffers=1GB" \
--dn-guc="bulk_write_ring_size=2GB" \
--dn-guc="cstore_buffers=1GB"

检测数据库状态

su - omm
$ gs_om -t start
$ gs_om -t status --detail
------------
[   Cluster State   ]

cluster_state   : Normal
redistributing  : No
current_az      : AZ_ALL

[  Datanode State   ]

    node     node_ip         port      instance                             state
-------------------------------------------------------------------------------------------------
1  dbtestenv 192.168.56.50   15400      6001 /opengauss/install/data/dn01   P Primary Normal
------------

$ gsql -d postgres -p 15400 -r
gsql ((openGauss 3.0.0 build 02c14696) compiled at 2022-04-01 18:12:34 commit 0 last mr  )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.

postgres=# postgres=# \l
   Name    | Owner | Encoding  | Collate | Ctype | Access privileges 
-----------+-------+-----------+---------+-------+-------------------
 postgres  | omm   | SQL_ASCII | C       | C     | 
 template0 | omm   | SQL_ASCII | C       | C     | =c/omm           +
           |       |           |         |       | omm=CTc/omm
 template1 | omm   | SQL_ASCII | C       | C     | =c/omm           +
           |       |           |         |       | omm=CTc/omm
(3 rows)

postgres=# select version();
------------------------------------------------------------------------------------------------------------------------------------------------------
 (openGauss 3.0.0 build 02c14696) compiled at 2022-04-01 18:12:34 commit 0 last mr   on x86_64-unknown-linux-gnu, compiled by g++ (GCC) 7.3.0, 64-bit
(1 row)

数据库卸载清除

1.卸载数据库
$ gs_uninstall --delete-data
Checking uninstallation.
Successfully checked uninstallation.
Stopping the cluster.
Successfully stopped cluster.
Successfully deleted instances.
Uninstalling application.
Successfully uninstalled application.
Uninstallation succeeded.
2.一键式环境清理
# ./gs_postuninstall -U omm -X /u01/app/software/script/clusterconfig.xml --delete-user --delete-group
Parsing the configuration file. 
Successfully parsed the configuration file. 
Check log file path. 
Successfully checked log file path. 
Checking unpreinstallation. 
Successfully checked unpreinstallation. 
Deleting the instance's directory. 
Successfully deleted the instance's directory. 
Deleting the temporary directory. 
Successfully deleted the temporary directory. 
Deleting software packages and environmental variables of the local node. 
Successfully deleted software packages and environmental variables of the local nodes. 
Deleting local OS user. 
Successfully deleted local OS user. 
Deleting local node's logs. 
Successfully deleted local node's logs. 
Successfully cleaned environment.
3.删除残留目录
[root@node1 install]# ll
total 0
drwx------ 2 1001 dbgrp 6 May 19 17:43 app_78689da9
drwx------ 3 1001 dbgrp 16 May 19 15:54 data
drwx------ 2 1001 dbgrp 6 May 19 17:58 om[root@db1 
~]# rm -fr /opt/huawei

与[转帖]openGauss 3.0 单节点安装部署相似的内容:

[转帖]openGauss 3.0 单节点安装部署

https://www.modb.pro/db/568455?utm_source=index_ori openGauss来源于PostgreSQL 9.2.4pg使用c实现,gs使用c++实现一个实例多个库 单机HA不是支持一主一备,提供高可靠和读扩展,备机最多8套。 主备部署模块说明:OM运维管

[转帖]openGauss 3.0 单节点安装部署

https://cdn.modb.pro/db/568455 openGauss来源于PostgreSQL 9.2.4pg使用c实现,gs使用c++实现一个实例多个库 单机HA不是支持一主一备,提供高可靠和读扩展,备机最多8套。 主备部署模块说明:OM运维管理模块:提供日常运维、配置管理接口,工具在

[转帖]openGauss 3.0 单节点安装部署

https://cdn.modb.pro/db/568455 openGauss来源于PostgreSQL 9.2.4pg使用c实现,gs使用c++实现一个实例多个库 单机HA不是支持一主一备,提供高可靠和读扩展,备机最多8套。 主备部署模块说明:OM运维管理模块:提供日常运维、配置管理接口,工具在

[转帖]openGauss_3.1.0 企业版_x86_64安装教程

https://www.cnblogs.com/cjnlll/p/16849620.html 1. 安装环境 VMware、Xshell、Xftp openeuler操作系统 openEuler-20.03-LTS-x86_64安装教程:https://www.cnblogs.com/cjnlll/

[转帖]openGauss兑现承诺:7家伙伴发布3.0发行版,3.1 社区创新版9月面世

https://www.doit.com.cn/p/482334.html openGauss Developer Day(openGauss开发者大会)2022在北京顺利召开。这是openGauss开源社区发起并主办的面向数据库开发者的年度活动。 在大会上,openGauss开源社区理事长江大勇发

[转帖]Centos 7 部署 openGauss 3.1.0 级联备库集群及集群缩容删除节点-运维指南

https://www.yisu.com/zixun/kf/ 一、安装环境设置 1.1 硬件环境 名称最低配置建议配置测试配置 服务器数量 3 略 略 硬盘 * 至少1GB用于安装openGauss的应用程序。* 每个主机需大约300MB用于元数据存储。* 预留70%以上的磁盘剩余空间用于数据存储。

[转帖]手把手教你安装openGauss 3.1.0

手把手教你安装openGauss 3.1.0 目录 前言 一、安装包的下载 1、centos 7.6的下载 2、openEuler 20.03LTS的下载 3、openGauss安装包的下载 二、安装环境的准备 1、硬件环境要求 2、软件环境要求 3、软件依赖要求 4、关闭操作系统防火墙 6、设置操

[转帖]Centos 7.6 安装部署 openGauss 3.1.0 企业版一主两备集群

https://www.cnblogs.com/dbajacky/p/16904017.html 一、安装环境设置 1.1 硬件环境 名称最低配置建议配置测试配置 服务器数量 3 略 略 硬盘 * 至少1GB用于安装openGauss的应用程序。* 每个主机需大约300MB用于元数据存储。* 预留7

[转帖]Centos 7.6 安装部署 openGauss 3.1.0 企业版一主两备集群

https://www.cnblogs.com/dbajacky/p/16904017.html 一、安装环境设置 1.1 硬件环境 名称最低配置建议配置测试配置 服务器数量 3 略 略 硬盘 * 至少1GB用于安装openGauss的应用程序。* 每个主机需大约300MB用于元数据存储。* 预留7

[转帖]openGauss单机部署

作者:可达 openGauss单机部署 一、安装环境 1.操作系统:虚拟机VMware、CentOS7.9 2.环境设置: (1)虚拟机内存3G、磁盘100G (2)系统版本修改 一开始使用了centos8,无法安装,因此降低版本,选用7.9后依然存在一些问题,因此修改/etc/redhat-rel