CentOS 7.9 安装 openGauss 2.1.0 之剥茧抽丝

CentOS 7.9 安装 openGauss 2.1.0 之剥茧抽丝

问天的天问 2021/12/23

本文是在参考官方的安装文档后,提取总结出的关键安装步骤。

[1] 基础环境安装

# timedatectl set-timezone Asia/Shanghai
# hostnamectl set-hostname gauss01

# nmcli con mod enp0s3 ipv4.method manual ipv4.address ***.***.***.***31/24
# nmcli con mod enp0s3 ipv4.gateway ***.***.***.***
# nmcli con mod enp0s3 ipv4.dns ***.***.***.***
# nmcli con mod enp0s3 connection.autoconnect yes

[2] Disable SElinux

# sed -i 's@\(^SELINUX=\).*@\1disabled@g' /etc/selinux/config

[3] Disable Firewall

# systemctl disable firewalld

[4] Disable Transparent HugePages

# sed -i '/linux16.*$/s//& transparent_hugepage=never/g' /boot/grub2/grub.cfg

Reboot and Confirm
# cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]

[5] 文件句柄设置

# cat >> /etc/security/limits.conf << EOF

*`echo -e "\t"`soft`echo -e "\t"`nofile`echo -e "\t"`1000000
*`echo -e "\t"`hard`echo -e "\t"`nofile`echo -e "\t"`1000000
EOF

[6] 网卡设置

在网卡配置文件中最后一行添加 MTU=8192

# cat /etc/sysconfig/network-scripts/ifcfg-enp0s3
……
MTU=8192

[7] 修改默认版本号

# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
修改为
CentOS Linux release 7.6.1810 (Core)

[8] 系统参数

在内核方面,官方给出的建议值基本上与系统 CentOS 7.9 的默认值相同,不相同的只有 4 项,如下:

  • net.ipv4.tcp_retries1
  • net.ipv4.tcp_syn_retries
  • net.ipv4.ip_local_port_range
  • vm.overcommit_ratio

根据实际情况判定是否需要修改。

[9] 安装 python

# yum install -y python36

[10] 安装软件包

官方建议软件包

# yum install -y libaio-devel flex bison ncurses-devel glibc-devel patch redhat-lsb readline-devel

个人建议软件包

# yum install -y bzip2 net-tools lrzsz

[11] 关闭 RemoveIPC

CentOS 默认关闭,无需要配置。

[12] 创建组和用户

组和用户都可以不用提前创建,在安装时会自动创建。

[13] 解压安装包

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

上传源码 openGauss-2.1.0-CentOS-64bit-all.tar.gz 并解压
# tar -zxvf openGauss-2.1.0-CentOS-64bit-all.tar.gz
# tar -zxvf openGauss-2.1.0-CentOS-64bit-om.tar.gz

[14] 编辑配置脚本

# cp script/gspylib/etc/conf/cluster_config_template.xml cluster_config.xml
# vi /opt/software/openGauss/cluster_config.xml
<?xml version="1.0" encoding="utf-8"?>
<ROOT>
<CLUSTER>
<PARAM name="clusterName" value="dbCluster" />
<PARAM name="nodeNames" value="gauss01"/>
<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" />
<PARAM name="corePath" value="/opt/huawei/corefile"/>
<PARAM name="backIp1s" value="***.***.***.***71"/>
</CLUSTER>

<DEVICELIST>
<DEVICE sn="node1_hostname">
<PARAM name="name" value="gauss01"/>
<PARAM name="azName" value="AZ1"/>
<PARAM name="azPriority" value="1"/>
<PARAM name="backIp1" value="***.***.***.***71"/>
<PARAM name="sshIp1" value="***.***.***.***71"/>
<!-- dn -->
<PARAM name="dataNum" value="1"/>
<PARAM name="dataPortBase" value="15400"/>
<PARAM name="dataNode1" value="/opt/huawei/install/data/dn1"/>
<PARAM name="dataNode1_syncNum" value="0"/>
</DEVICE>

</DEVICELIST>
</ROOT>

根据实际情况进行相应修改。

[15] 执行安装和初始化

以 root 用户安装,安装脚本自行创建 dbgrp 组和 omm 用户

# cd script
# python3 gs_preinstall -U omm -G dbgrp -X /opt/software/openGauss/cluster_config.xml

以 omm 用户初始化数据库

# chown -R omm:dbgrp /opt/software/openGauss
# su - omm
$ gs_install -X /opt/software/openGauss/cluster_config.xml

初始化成功后连接数据库

$ gsql -d postgres -p 15400
gsql ((openGauss 2.1.0 build 590b0f8e) compiled at 2021-09-30 14:29:04 commit 0 last mr )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.

openGauss=#

其中,postgres 为需要连接的数据库名称,15400 为数据库节点的端口号,即 cluster_config.xml 配置文件中的 dataPortBase 的值。

[16] 卸载 openGauss

# su - omm
$ gs_uninstall --delete-data
命令卸载并不全面,还需要手工删除,也可不经命令卸载直接手工删除。
# userdel -r omm
# groupdel dbgrp
# rm -rf /opt/software /opt/huawei
# rm -rf /var/log/omm

相关推荐

  1. CentOS 7.9 安装 openGauss 2.1.0 抽丝

    2024-03-10 07:00:11       45 阅读
  2. 抽丝设计模式-目录

    2024-03-10 07:00:11       69 阅读
  3. virtualbox安装openGauss

    2024-03-10 07:00:11       56 阅读
  4. openGauss安装与使用

    2024-03-10 07:00:11       42 阅读
  5. Centos7安装Nginx-1.21

    2024-03-10 07:00:11       53 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-03-10 07:00:11       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-03-10 07:00:11       106 阅读
  3. 在Django里面运行非项目文件

    2024-03-10 07:00:11       87 阅读
  4. Python语言-面向对象

    2024-03-10 07:00:11       96 阅读

热门阅读

  1. webpack5基础--12_开发服务器&自动化

    2024-03-10 07:00:11       50 阅读
  2. [BUG]Windows安装WSL报错

    2024-03-10 07:00:11       49 阅读
  3. ColorStateList在自定义Drawable中的应用

    2024-03-10 07:00:11       42 阅读
  4. 初识 Verilog

    2024-03-10 07:00:11       46 阅读
  5. 区块链web3智能合约Solidity学习资源整理

    2024-03-10 07:00:11       45 阅读
  6. 【MySQL 系列】在 Ubuntu 上安装 MySQL

    2024-03-10 07:00:11       49 阅读