文章目录
提示:以下是本篇文章正文内容,下面案例可供参考
1.openGauss 安装流程(单主机企业版)
注意:
安装
可以用root用户,但是使用
不可以用root用户
硬件要求:
最好使用4核8G
环境要求:
需要安装:
libaio-devel
expelt #主备需要
1.1 下载对应安装包
官网:https://opengauss.org/zh/download/
https://opengauss.obs.cn-south-1.myhuaweicloud.com/5.0.0/x86/openGauss-5.0.0-CentOS-64bit-all.tar.gz
关闭防火墙
1.2 修改操作系统配置
关闭操作系统防火墙:
目前仅支持在防火墙关闭的状态下进行安装,为了在防火墙开启的状态下,确保openGauss的正常使用。
步骤1:修改/etc/selinux/config文件中的“SELINUX”值为“disabled” 。
使用VIM打开config文件。
修改“SELINUX”的值“disabled” ,执行 :wq 保存并退出修改。
vim /etc/selinux/config
SELINUX=disabled
步骤2:重新启动系统。
reboot
步骤3:检查防火墙是否关闭。
若防火墙状态显示为active (running),则表示防火墙未关闭,请执行步骤4;
若防火墙状态显示为inactive (dead),则无需再关闭防火墙。
systemctl status firewalld
步骤4:关闭防火墙。
systemctl stop firewalld.service
systemctl disable firewalld.service
步骤5:在各主机上重复步骤1到步骤4.
设置字符集参数:
将各数据库节点的字符集设置为相同的字符集,可以在 /etc/profile 文件中添加“export LANG=XXX” (XXX为Unicode编码)。
/etc/profile << export LANG=en_US.UTF-8
l 设置时区和时间:
p 在各数据库节点上,确保时区和时间一致。
p 步骤1:执行如下命令检查各数据库节点时间和时区是否一致。如果各数据库节点时间和时区不一致区,请执行步骤2~步骤3。
date
p 步骤2:使用如下命令将各数据库节点 /usr/share/zoneinfo/ 目录下的时区文件拷贝为 /etc/localtime 文件。
cp /usr/share/zoneinfo/
地区
/
地区/
地区/时区 /etc/localtime
p 步骤3:使用date -s命令将各数据库节点的时间设置为统一时间,举例如下。
cp /usr/share/zoneinfo/$地区/$时区 /etc/localtime
date -s ”Sat Sep 27 16:00:07 CST 2020”
关闭RemoveIPC:
当我们退出,相关信息会被移除,关闭就不会
p 在各数据库节点上,关闭RemoveIPC。 CentOS7.6操作系统默认关闭RemoveIPC,可以跳过该步骤。
p 步骤1:修改 /etc/systemd/logind.conf 文件中的“RemoveIPC”值为“no”。
n 使用 VIM 打开 logind.conf 文件。
n 修改“RemoveIPC”的值“no”。
vim /etc/systemd/logind.conf
RemoveIPC=no
步骤2:修改 /usr/lib/systemd/system/systemd-logind.service 文件中的“RemoveIPC”值为“no”。
n 使用 VIM 打开 systemd-logind.service 文件。
n 修改“RemoveIPC”的值“no”。
vim /usr/lib/systemd/system/systemd-logind.service
RemoveIPC=no
p 步骤3:重新加载配置参数。
systemctl daemon-reload
systemctl restart systemd-logind
p 步骤4:检查修改是否生效。
loginctl show-session | grep RemoveIPC
systemctl show systemd-logind | grep RemoveIPC
关闭THP服务
echo never >> /sys/kernel/mm/transparent_hugepage/defrag
echo never >> /sys/kernel/mm/transparent_hugepage/enabled
echo 'echo never >> /sys/kernel/mm/transparent_hugepage/defrag' >> /etc/rc.d/rc.local
echo 'echo never >> /sys/kernel/mm/transparent_hugepage/enabled' >> /etc/rc.d/rc.local
chmod +x /etc/rc.d/rc.local
/etc/rc.d/rc.local
p 步骤5:在各主机上重复步骤1到步骤4。
设置网卡MTU值:
p 将各数据库节点的网卡MTU值设置为相同大小。
p 步骤1:执行如下命令查询服务器的网卡名称。
ifconfig
如下图,若服务器的 IP 为10.244.53.173,则服务器的网卡名称为 eth0。
步骤2:使用如下命令将各数据库节点的网卡MTU值设置为相同大小。对于X86,MTU值推荐1500(默认);对于ARM,MTU值推荐8192。
ifconfig 网卡名称 mtu mtu值
可以不用的操作
2.配置
2.1 改名
在主备中名字必须不一样
用hostname
查看
修改用 hostnamectl set-hostname 新名字
2.2 查询python 版本
mv /usr/bin/python /usr/bin/python.bak
ln -s /usr/bin/python3 /usr/bin/python
3. 安装
3.1创建目录
mkdir /opt/software/openGauss -p
3.2 下载安装包
3.3 配置
tar -xvf /root/openGauss-5.0.0-CentOS-64bit-all.tar.gz -C /opt/software/openGauss/
tar -xvf /opt/software/openGauss/openGauss-5.0.0-CentOS-64bit-om.tar.gz
cd /opt/software/openGauss/script
swapoff -a #关闭交换空间
检测
./gs_checkos -i A
参数说明:
Normal #不用管
Warning #可以不管
Abnormal #一定要管
进行修改
./gs_checkos -i B
vim /opt/software/openGauss/config.xml
vim /opt/software/openGauss/config.xml
<?xml version="1.0" encoding="UTF-8"?>
<ROOT>
<!-- openGauss整体信息 -->
<CLUSTER>
<!-- 数据库名称 -->
<PARAM name="clusterName" value="dbCluster" />
<!-- 数据库节点名称(hostname)必须改 -->
<PARAM name="nodeNames" value="ecs-gaoussdb" />
<!-- 数据库安装目录-->
<PARAM name="gaussdbAppPath" value="/opt/software/install/app" />
<!-- 日志目录-->
<PARAM name="gaussdbLogPath" value="/opt/software/log/omm" />
<!-- 临时文件目录-->
<PARAM name="tmpMppdbPath" value="/opt/software/tmp" />
<!-- 数据库工具目录-->
<PARAM name="gaussdbToolPath" value="/opt/software/om" />
<!-- 数据库core文件目录-->
<PARAM name="corePath" value="/opt/software/corefile" />
<!-- 节点IP,与数据库节点名称列表一一对应必须改 -->
<PARAM name="backIp1s" value="192.168.1.112"/>
</CLUSTER>
<!-- 每台服务器上的节点部署信息 -->
<DEVICELIST>
<!-- 节点1上的部署信息 -->
<DEVICE sn="node1_hostname">
<!-- 节点1的主机名称必须改 -->
<PARAM name="name" value="ecs-gaoussdb"/>
<!-- 节点1所在的AZ及AZ优先级 -->
<PARAM name="azName" value="AZ1"/>
<PARAM name="azPriority" value="1"/>
<!-- 节点1的IP,如果服务器只有一个网卡可用,将backIP1和sshIP1配置成同一个IP必须改 -->
<PARAM name="backIp1" value="192.168.1.112"/>
<!-- 多个ip这个可以不一样 -->
<PARAM name="sshIp1" value="192.168.1.112"/>
<!--dbnode-->
<PARAM name="dataNum" value="1"/>
<!-- 使用的端口 -->
<PARAM name="dataPortBase" value="8000"/>
<!-- 数据库存放位置 -->
<PARAM name="dataNode1" value="/opt/software/install/data/dn"/>
<PARAM name="dataNode1_syncNum" value="0"/>
</DEVICE>
</DEVICELIST>
</ROOT>
赋权:
chmod -R 777 /opt/software/
3.4 预安装:
/opt/software/openGauss/script/gs_preinstall -U omm -G dbgrp -X /opt/software/openGauss/config.xml
-U omm:表示使用omm作为用户。
-G dbgrp:表示使用dbgrp作为用户组。
-X config.xml:表示使用config.xml作为配置文件。
[root@ecs-gaoussdb openGauss]# script/gs_preinstall -U omm -G dbgrp -X 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.
Setting host ip env
Successfully set host ip env.
Are you sure you want to create the user[omm] (yes/no)? yes #创建用户
Please enter password for cluster user.#设置密码
Password:
Please enter password for cluster user again.
Password:
Generate cluster user password files successfully.
Successfully created [omm] user on all nodes.
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 ecs-gaoussdb --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.
Error: Failed to set Cgroup.
[GAUSS-50201] : The libaio.so or libaio.so.* does not exist.
报错:
libaio.so或libaio.so.*不存在。
修改:
#将首行改为#! /usr/bin/python.bak
vim /usr/bin/yum
vim /usr/libexec/urlgrabber-ext-down
安装:
yum install libaio* -y
重新安装
[root@ecs-gaoussdb openGauss]# script/gs_preinstall -U omm -G dbgrp -X 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.
Setting host ip env
Successfully set host ip env.
Are you sure you want to create the user[omm] (yes/no)? Please type 'yes' or 'no': no
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 ecs-gaoussdb --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. #安装成功
权限被改回来了
重新更改
3.5 安装
切换用户
su - omm
script/gs_install -X config.xml
报错
上图提示内存不够。
把系统做成镜像,重新做一台但是一直报错,删除文件夹也是报错有大佬知道教教
下面是4核8G从新装的服务器做的
[omm@ecs-db openGauss]$ script/gs_install -X config.xml
Parsing the configuration file.
Check preinstall on every node.
Successfully checked preinstall on every node.
Creating the backup directory.
Successfully created the backup directory.
begin deploy..
Installing the cluster.
begin prepare Install Cluster..
Checking the installation environment on all nodes.
begin install Cluster..
Installing applications on all nodes.
Successfully installed APP.
begin init Instance..
encrypt cipher and rand files for database.
Please enter password for database: #设置数据库密码
Please repeat for database:
begin to create CA cert files
The sslcert will be generated in /opt/software/install/app/share/sslcert/om
NO cm_server instance, no need to create CA for CM.
Non-dss_ssl_enable, no need to create CA for DSS
Cluster installation is completed.
Configuring.
Deleting instances from all nodes.
Successfully deleted instances from all nodes.
Checking node configuration on all nodes.
Initializing instances on all nodes.
Updating instance configuration on all nodes.
Check consistence of memCheck and coresCheck on database nodes.
Configuring pg_hba on all nodes.
Configuration is completed.
The cluster status is Normal.
Successfully started cluster.
Successfully installed application.
end deploy..
3.5.1 查询集群状态
gs_om -t status
gs_om -t status --detail
关闭:
gs_om -t stop
关闭的状态