当前位置:网站首页>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 数据库的安装过程,需要修改的配置文件非常多,大家再学习的时候,可以不断进行修改,按照错误提示,哪里出错改哪里,本文从基础配置入手,下篇博客我们将对配置进行复盘,下篇见。
边栏推荐
- Error:Kotlin: Module was compiled with an incompatible version of Kotlin. The binary version of its
- Anaconda 中使用 You Get
- When MFC uses the console, the project path cannot have spaces or Chinese, otherwise an error will be reported. Lnk1342 fails to save the backup copy of the binary file to be edited, etc
- 10 common malware detection and analysis platforms
- Several misunderstandings of VPN
- In the era of industrial Internet, there are no more centers in the real sense, and these centers just turn tangible into intangible
- Maxcompute remote connection, uploading and downloading data files
- 面试中的最常被问到的两种锁
- Obtain the package name, application name, icon, etc. of the uninstalled APK through packagemanager. There is a small message
- (cve-2020-11978) command injection vulnerability recurrence in airflow DAG [vulhub range]
猜你喜欢

Alibaba cloud full link data governance

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

RDD basic knowledge points

Ultra wideband pulse positioning scheme, UWB precise positioning technology, wireless indoor positioning application

First acquaintance with JUC - day01

语料库数据处理个案实例(读取多个文本文件、读取一个文件夹下面指定的多个文件、解码错误、读取多个子文件夹文本、多个文件批量改名)

Camera calibration (calibration purpose and principle)

Session & cookie details

2022年PMP项目管理考试敏捷知识点(1)

When MFC uses the console, the project path cannot have spaces or Chinese, otherwise an error will be reported. Lnk1342 fails to save the backup copy of the binary file to be edited, etc
随机推荐
Unity 的序列化
《canvas》之第2章 直线图形
How to delete / select an input method on your computer
日期、时间库使用备注
A case of bouncing around the system firewall
(cve-2020-11978) command injection vulnerability recurrence in airflow DAG [vulhub range]
Global and Chinese market of offshore furnaces 2022-2028: Research Report on technology, participants, trends, market size and share
UTC、GMT、CST
Win11 points how to divide disks? How to divide disks in win11 system?
Overview of C program operation mechanism
C escape character
鸿蒙os开发三
《canvas》之第4章 线条操作
[MySQL usage Script] clone data tables, save query data to data tables, and create temporary tables
Global and Chinese market of anion sanitary napkins 2022-2028: Research Report on technology, participants, trends, market size and share
Extend ado Net to realize object-oriented CRUD (.Net core/framework)
New features of PHP: bytecode cache and built-in server
Spark stage and shuffle for daily data processing
What industries and scenarios can the easynvr/easygbs/easycvr platform developed by tsingsee green rhino video be used in?
Pyhton crawls to Adu (Li Yifeng) Weibo comments