当前位置:网站首页>OpenGauss数据库在 CentOS 上的实践,配置篇
OpenGauss数据库在 CentOS 上的实践,配置篇
2022-06-24 06:46:00 【梦想橡皮擦】
服务器准备
本篇博客可以使用华为云提供的测试 ECS,进行实践,领取地址为:https://activity.huaweicloud.com/free_test/
如果没有领取到或者名额已满,可以用 VM 在本地安装一个虚拟主机,在安装 CentOS 即可。
本实验为了发现潜在问题,顾橡皮擦选择了一款站外服务器,配置如下:
1 CPU 2 GB / CentOS 7.6 64位 / 40 GB 系统盘
SSH 连接软件使用 FinalShell,连接之后的效果图如下所示:

查看一下系统版本信息。
cat /etc/redhat-release

环境准备好之后,就可以修改一下 yum 源了。
切换 yum 源为 华为源
CentOS 默认访问国外源,为了加速可以将其切换到华为源。
操作步骤如下所示:
1. 安装 wget
yum install wget -y
2. 备份官方源
cd /etc/yum.repos.d/
rename repo repo.old CentOS-*.repo
3. 下载华为源
wget -O /etc/yum.repos.d/CentOS-Base.repo https://repo.huaweicloud.com/repository/conf/CentOS-7-reg.repo

4. 清除原缓存+生成新缓存
yum clean all
yum makecache

也可以查看配置文件的同时,刷新缓存
yum repolist all
安装 opengauss
环境配置完毕,就可以进入安装环节了,使用如下命令操作即可。
yum install -y libaio-devel flex bison ncurses-devel glibc.devel patch lsb_release openssl* python3
状态提示信息
安装成功提示信息如下所示:
切换系统默认 Python 版本
进入 /usr/bin 目录,备份 Python 文件
cd /usr/bin
备份 Python 文件,同时建立 python3 软连接
mv python python.bak
ln -s python3 /usr/bin/python
此时切换完毕,使用 python3 已经得到相应的输出。
关闭防火墙
由于官方仅支持在防火墙关闭情况下进行安装,所以需要参考下述设置
[[email protected] yum.repos.d]# systemctl disable firewalld.service
[[email protected] yum.repos.d]# systemctl stop firewalld.service
查看防火墙状态,使用 systemctl status firewalld。
关闭 selinux
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
查看是否关闭,请使用如下命令:
cat /etc/selinux/config

设置字符集
cat >> /etc/profile <<EOF
> export LANG=en_US.UTF-8
> EOF
可以查看设置之后的内容,效果如下:
最后执行下述命令,确保配置生效。
source /etc/profile
关闭交换内存
swapoff -a
该点是由于我们目前这台服务器内存过小,防止一会安装后,数据库崩溃。
创建安装用户,用户组和软件安装目录
建立用户组
[[email protected] bin]# groupadd dbgrp
[[email protected] bin]# useradd -g dbgrp -d /home/omm -m -s /bin/bash omm
[[email protected] bin]# echo "omm" | passwd --stdin omm
[[email protected] bin]# mkdir -p /opt/software/openGauss
[[email protected] bin]# chmod 755 -R /opt/software
[[email protected] bin]# chown -R omm:dbgrp /opt/software/openGauss

配置到这里,可以暂停,重启一下操作系统
设置时区
对下述文件进行操作。
rm -fr /etc/localtime
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
ll /etc/localtime
关闭 RemoveIPC
修改 /etc/systemd/logind.conf 文件中的 RemoveIPC 参数为 no。
保存使用 wq!。
修改 /usr/lib/systemd/system/systemd-logind.service 文件中 RemoveIPC 参数,如果没有,手动补充该值。

RemoveIPC=no
设置网卡 MTU 值
使用 ifconfig 查看网卡信息。
对于 X86,MTU 值推荐 1500;对于 ARM,MTU 值推荐 8192。
ifconfig eth0 mtu 1500
安装 OpenGauss
打开软件下载地址:https://opengauss.org/zh/download.html,选择轻量版本。
下载之后,上传到上文创建的 /opt/software/openGauss 目录即可。
解压文件,使用如下命令:
tar -zxvf openGauss-3.0.0-CentOS-64bit-all.tar.gz
tar -zxvf openGauss-3.0.0-CentOS-64bit-om.tar.gz
解压后的目录结构为:

下面继续配置 openGauss 的 cluster_config.xml 文件,该文件包含 openGauss 的服务器信息、安装路径、IP 地址、端口号等内容。
将模板拷贝到 \opt\software\openGauss 目录下,命令如下所示:
cp /script/gspylib/etc/conf/cluster_config_template.xml /opt/software/openGauss
修改一下文件名称 cluster_config.xml。
mv cluster_config_template.xml cluster_config.xml

使用 vim cluster_config.xml 打开配置文件,然后修改如下内容(该文件最好是在本地修改之后,在进行上传):
再次确定一下 hostname 一致。
hostname
cat /etc/hostname

然后再次修改 cluster_config.xml 文件的 hostname。

加载环境变量
export LD_LIBRARY_PATH=/opt/software/Gauss/script/gspylib/clib:$LD_LIBRARY_PATH
创建目录并赋权
mkdir –p /opt/huawei
chmod 777 -R /opt/huawei
添加网络内核参数
vim /etc/sysctl.conf
添加内容如下所示:
net.ipv4.tcp_retries1 = 5
net.ipv4.tcp_syn_retries = 5
net.sctp.path_max_retrans = 10
net.sctp.max_init_retransmits = 10
下面进入 cd /opt/software/openGauss/script 目录,执行下述命令开始尝试运行我们上文配置的所有内容。
./gs_preinstall -U omm -G dbgrp -X /opt/software/openGauss/cluster_config.xml
结果出现如下错误,按照错误提示开始进如复盘环节,这就是我们下篇博客涉及的内容了。

openGauss 数据库的安装过程,需要修改的配置文件非常多,大家再学习的时候,可以不断进行修改,按照错误提示,哪里出错改哪里,本文从基础配置入手,下篇博客我们将对配置进行复盘,下篇见。
边栏推荐
- UTC、GMT、CST
- Global and Chinese market of water massage column 2022-2028: Research Report on technology, participants, trends, market size and share
- Detailed explanation of C language compilation, link and operation
- Session & cookie details
- How to realize high stability and high concurrency of live video streaming transmission and viewing?
- Deploy L2TP in VPN (Part 1)
- 线程的支持
- L2tp/ipsec one click installation script
- [MySQL usage Script] clone data tables, save query data to data tables, and create temporary tables
- Common coding and encryption in penetration testing
猜你喜欢
![[pointnet] matlab simulation of 3D point cloud target classification and recognition based on pointnet](/img/86/5db689cdac2a927a23dff3fb9594b0.png)
[pointnet] matlab simulation of 3D point cloud target classification and recognition based on pointnet

Description of module data serial number positioning area code positioning refers to GBK code

相機標定(標定目的、原理)

Alibaba cloud full link data governance

Étalonnage de la caméra (objectif et principe d'étalonnage)

本地备份和还原 SQL Server 数据库

Maxcompute remote connection, uploading and downloading data files

【008】表格数据逐行筛选,跳出for循环及跳过本次循环思路_#VBA
![[tips] use the deep learning toolbox of MATLAB deepnetworkdesigner to quickly design](/img/74/f615191715a9ac58a8546f8d1e8f8d.png)
[tips] use the deep learning toolbox of MATLAB deepnetworkdesigner to quickly design

Win11 points how to divide disks? How to divide disks in win11 system?
随机推荐
Win10 build webservice
Description of module data serial number positioning area code positioning refers to GBK code
希尔伯特-黄变换
相機標定(標定目的、原理)
线程的支持
atguigu----15-内置指令
Cloud development who is the source code of undercover applet
Terminal network in VPN client connection settings of router
GPU is not used when the code is running
2.1.1 QML grammar foundation I
日期、时间库使用备注
Étalonnage de la caméra (objectif et principe d'étalonnage)
PNAs: Geometric renormalization reveals the self similarity of multi-scale human connectome
Global and Chinese markets for food puffers 2022-2028: Research Report on technology, participants, trends, market size and share
Tencent cloud security and privacy computing has passed the evaluation of the ICT Institute and obtained national recognition
常见的数组封装
L2TP connection failure guide in VPN
Knowledge points of 2022 system integration project management engineer examination: ITSS information technology service
[learn FPGA programming from scratch -41]: vision chapter - Moore's era and Moore's law and the arrival of the post Moore Era
Overview of C program operation mechanism