安装openGauss 6.0.0
yum源配置
#本地源
mount /dev/cdrom /mnt
cd /etc/yum.repos.d
mkdir bk
mv *.repo bk/
cat >test.repo<<EOF
[EL7]
name = linux 7.6 dvd
baseurl=file:///mnt
gpgcheck=0
enabled=1
EOF#华为在线源
wget -O /etc/yum.repos.d/CentOS-Base-H.repo https://repo.huaweicloud.com/repository/conf/CentOS-7-reg.repo
lvm设置
[root@ogos ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 100G 0 disk
├─sda1 8:1 0 7.5G 0 part [SWAP]
└─sda2 8:2 0 92.6G 0 part /
sdb 8:16 0 200G 0 disk
sr0 11:0 1 1024M 0 rom
[root@ogos ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 93G 1.9G 91G 2% /
devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 1.9G 12M 1.9G 1% /run
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
tmpfs 378M 0 378M 0% /run/user/0
[root@ogos ~]# pvcreate /dev/sdb
vgcreate ogvg /dev/sdb
lvcreate -n oglv -L 200000M ogvg
mkfs.ext4 /dev/ogvg/oglv
mkdir /openGauss
echo "/dev/ogvg/oglv /openGauss ext4 defaults 0 0" >> /etc/fstab
mount /openGauss[root@ogos ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 93G 1.9G 91G 3% /
devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 1.9G 12M 1.9G 1% /run
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
tmpfs 378M 0 378M 0% /run/user/0
/dev/sr0 4.3G 4.3G 0 100% /mnt
/dev/mapper/ogvg-oglv 193G 61M 183G 1% /openGauss
[root@ogos ~]#
操作系统配置
#1、安装Python3(编译安装,或者yum 安装)
yum install python3
python3 -V#2、安装依赖包
yum install -y libaio-devel
yum install -y flex
yum install -y bison
yum install -y ncurses-devel
yum install -y glibc-devel
yum install -y patch
yum install -y redhat-lsb-core
yum install -y readline-devel
yum install -y libnsl #(openEuler+x86环境中)#检查依赖包是否安装成功
rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n' libaio-devel flex bison ncurses-devel glibc-devel patch redhat-lsb-core readline-devel#3、关闭防火墙
systemctl disable firewalld.service
systemctl stop firewalld.service
systemctl status firewalld.service#4、关闭SELinux
sed -n '/^SELINUX=/p' /etc/selinux/config
SELINUX=disabled
#sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
getenforce
#setenforce 0#5、设置字符集
#将各数据库节点的字符集设置为相同的字符集,可以在/etc/profile文件中添加“export LANG=XXX”(XXX为Unicode编码)。
sed -n '/LANG/p' /etc/profile
echo 'export LANG=en_US.UTF8' >> /etc/profile
#echo 'export LANG=zh_CN.UTF8' >> /etc/profile
source /etc/profile#6、设置时区和时间
#cp /usr/share/zoneinfo/$地区/$时区 /etc/localtime
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime#7、确定时间是否准确,修改时间示例:
date -s "Sat Sep 27 16:00:07 CST 2020"#8、设置网卡MTU值
#查看网卡的mtu值
ifconfig|awk -F '[: ]' '/mtu/{print $1,$NF}'
#使用如下命令将各数据库节点的网卡MTU值设置为相同大小。MTU值推荐8192,要求不小于1500。
ifconfig 网卡编号 mtu 值#9、关闭RemoveIPC
#在各数据库节点上,关闭RemoveIPC。CentOS操作系统无该参数,可以跳过该步骤。sed -n '/RemoveIPC/p' etc/systemd/logind.conf
sed -i 's/RemoveIPC=.*/RemoveIPC=no/g' etc/systemd/logind.conf
systemctl daemon-reload
systemctl restart systemd-logind
loginctl show-session | grep RemoveIPC
systemctl show systemd-logind | grep RemoveIPC#10、设置root用户远程登录
vim /etc/ssh/sshd_config
PermitRootLogin yesvim /etc/ssh/sshd_config
#Banner XXXXsystemctl restart sshd.service#11、配置/etc/hosts文件
echo '192.168.1.201 ogos' >> /etc/hosts
准备xml文件
cat > /tmp/one_node.xml << "EOF"
<?xml version="1.0" encoding="UTF-8"?>
<ROOT><!-- openGauss整体信息 --><CLUSTER><PARAM name="clusterName" value="onenode" /><PARAM name="nodeNames" value="ogos" /><PARAM name="gaussdbAppPath" value="/openGauss/app" /><PARAM name="gaussdbLogPath" value="/openGauss/log/omm" /><PARAM name="tmpMppdbPath" value="/openGauss/tmp" /><PARAM name="gaussdbToolPath" value="/openGauss/om" /><PARAM name="corePath" value="/openGauss/core" /><PARAM name="backIp1s" value="192.168.1.201"/></CLUSTER><!-- 每台服务器上的节点部署信息 --><DEVICELIST><!-- node1上的节点部署信息 --><DEVICE sn="ogos"><PARAM name="name" value="ogos"/><PARAM name="azName" value="AZ1"/><PARAM name="azPriority" value="1"/><!-- 如果服务器只有一个网卡可用,将backIP1和sshIP1配置成同一个IP --><PARAM name="backIp1" value="192.168.1.201"/><PARAM name="sshIp1" value="192.168.1.201"/><!--dbnode--><PARAM name="dataNum" value="1"/><PARAM name="dataPortBase" value="12345"/><PARAM name="dataNode1" value="/openGauss/data/dn"/><PARAM name="dataNode1_syncNum" value="0"/></DEVICE></DEVICELIST>
</ROOT>
EOF
下载解压安装包
mkdir -p /software/unzip
cd /software/unzip
tar -zxvf ../openGauss-All-6.0.0-CentOS7-x86_64.tar.gz
tar -zxvf openGauss-OM-6.0.0-CentOS7-x86_64.tar.gz
创建用户和组
groupadd dbgrp
useradd -g dbgrp -d /home/omm -m -s /bin/bash omm
echo test@123|passwd --stdin omm
chown -R omm:dbgrp /openGauss
数据库初始化
#预安装
cd /software/unzip/script
./gs_preinstall -U omm -G dbgrp -X /tmp/one_node.xml --sep-env-file=/home/omm/env#安装
su - omm
source /home/omm/env
gs_install -X /tmp/one_node.xml#安装后配置
su - omm
source /home/omm/env
#gsql终端设置
cd
cat >.gsqlrc <<EOF
\set PROMPT1 '%n@%~%R%#'
\pset border 2
EOF
#修改会话超时时间
gs_guc reload -N all -I all -c "session_timeout = 86400s"
gs_om -t restart
#查看集群状态
gs_om -t status --detail
#连接数据库
gsql -p 12345 -d postgres -r
卸载openGauss 6.0.0
su - omm
source /home/omm/env
gs_uninstall --delete-datasu - root
source /home/omm/env
./gs_postuninstall -U omm -X /opt/software/openGauss/cluster_config.xml --delete-user --delete-group
unset MPPDB_ENV_SEPARATE_PATH
参考资料
https://docs.opengauss.org/zh/docs/6.0.0/docs/InstallationGuide/企业版安装.html