测试环境
操作系统版本:openEuler-22.03-LTS-SP2-x86_64
硬件配置: 4c/8G/40GB
节点信息: [主节点] 172.20.XX.101
[备节点]
[级联备]
操作步骤
1. 从openGauss开源社区下载对应平台的安装包。
a.通过https://opengauss.org/zh/download/登录openGauss开源社区,选择对应平台的企业版安装包。
b.单击“下载”。
2. 检查安装包。
解压安装包,检查安装目录及文件是否齐全。在安装包所在目录执行以下命令:
tar -zxvf openGauss-x.x.x-openEuler-64bit-all.tar.gz
ls -lb
执行ls命令,显示类似如下信息:
total 91M
-rw-r--r-- 1 root root 65 Dec 25 11:03 openGauss-x.x.x-openEuler-64bit-om.sha256
-rw-r--r-- 1 root root 12910775 Dec 25 11:03 openGauss-x.x.x-openEuler-64bit-om.tar.gz
-rw-r--r-- 1 root root 13474 Dec 25 11:03 upgrade_sql.tar.gz
-rw-r--r-- 1 root root 65 Dec 25 11:03 upgrade_sql.sha256
-rw-r--r-- 1 root root 65 Dec 25 11:03 openGauss-x.x.x-openEuler-64bit.sha256
-rw-r--r-- 1 root root 73334256 Dec 25 11:03 openGauss-x.x.x-openEuler-64bit.tar.bz2
opengauss 5.1.0企业版安装指南
https://docs-opengauss.osinfra.cn/zh/docs/5.1.0/docs/InstallationGuide/%E4%BC%81%E4%B8%9A%E7%89%88%E5%AE%89%E8%A3%85.html
一、运行环境初始化
示例脚本如下[仅供参考]:
vi /root/initenv.sh
-------------------------------------------------------------------------------------------
#!/bin/bash
## 1.关闭 firewalld service
systemctl disable firewalld.service
systemctl stop firewalld.service
echo "Firewalld " `systemctl status firewalld|grep Active`
echo "1.Disable firewalld service completed."
echo -e "\n"
## 2. 关闭SELINUX
sed -i '/^SELINUX=/d' /etc/selinux/config
echo "SELINUX=disabled" >> /etc/selinux/config
cat /etc/selinux/config|grep "SELINUX=disabled"
echo "2.Disable SELINUX completed."
echo -e "\n"
## 3.配置Configure encoding
echo "LANG=en_US.UTF-8" >> /etc/profile
source /etc/profile
echo $LANG
echo "3.Configure encoding completed."
echo -e "\n"
## 4. 配置Configure Timezone
rm -fr /etc/localtime
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
date -R
hwclock
echo "4.Configure Timezone completed."
echo -e "\n"
## 5. 关闭 SWAP分区
sed -i '/swap/s/^/#/' /etc/fstab
swapoff -a
free -m
echo "5.Close swap partition completed."
echo -e "\n"
## optional options,please take care of this
## echo "MTU=8192" /etc/sysconfig/network-scripts/ifcfg-ens34
## For 10GB Ethernet environment , please set rx = 4096、tx = 4096
## 6. 配置 SSH Service
sed -i '/Banner/s/^/#/' /etc/ssh/sshd_config
sed -i '/PermitRootLogin/s/^/#/' /etc/ssh/sshd_config
echo -e "\n" /etc/ssh/sshd_config
echo "Banner none " >> /etc/ssh/sshd_config
echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
cat /etc/ssh/sshd_config |grep -v ^#|grep -E 'PermitRoot|Banner'
echo "6.Configure SSH Service completed."
echo -e "\n"
## 7. 安装依赖包(上网安装也可以配置本地yum)
mkdir /etc/yum.repos.d/bak
mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak/
wget -O /etc/yum.repos.d/CentOS-Base.repo https://repo.huaweicloud.com/repository/conf/openeuler_x86_64.repo
yum clean all
yum install -y bzip2 python3
yum install -y libaio-devel flex bison ncurses-devel glibc-devel patch redhat-lsb-core readline-devel
echo "7.Configure YUM and Install Packages completed."
echo -e "\n"
## 8. Close transparent_hugepage openeuler不需要配置
################Only for CentOS [Close transparent_hugepage]#####################
cat /etc/rc.d/rc.local /sys/kernel/mm/transparent_hugepage/enabled
fi
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
echo never >> /sys/kernel/mm/transparent_hugepage/defrag
fi
EOF
chmod +x /etc/rc.d/rc.local
echo "8.Close transparent_hugepage completed."
echo -e "\n"
################################################################################
## 9. 配置操作系统参数 Parameter
cat /etc/sysctl.conf
/etc/systemd/logind.conf
echo "RemoveIPC=no" >>
/usr/lib/systemd/system/systemd-logind.service
systemctl daemon-reload
systemctl restart systemd-logind
loginctl show-session | grep RemoveIPC
systemctl show systemd-logind | grep RemoveIPC
echo "10.Disable RemoveIPC completed."
echo -e "\n"
echo -e "\n"
##########################################################################
-------------------------------------------------------------------------------------------
sh /root/initenv.sh ##
执行初始化脚本
[SCTP
内核参数告警可以忽略
]
关闭HISTORY记录(可以不关闭)
步骤 1 修改根目录下/etc/profile文件。
vim /etc/profile
步骤 2 设置HISTSIZE值为0。例如,系统中HISTSIZE默认值为1000,将其修改为0。
HISTSIZE=0
步骤 3 保存/etc/profile。
:wq
步骤 4 设置/etc/profile生效。
source
/etc/profile
二、单机安装
mkdir –p /opt/software/openGauss
chmod 755 -R /opt/software
tar -jxf openGauss-x.x.x-openEuler-64bit.tar.bz2 -C
/opt/software/openGauss
tar -zxvf openGauss-5.1.0-openEuler-64bit-cm.tar.gz
groupadd dbgrp
useradd -g dbgrp omm
echo "Hyjc@2022" |passwd --stdin omm
设置lib库
export LD_LIBRARY_PATH=/opt/software/openGauss/script/gspylib/clib:$LD_LIBRARY_PATH
chown –R omm:dbgrp
/opt/software/openGauss
安装openGauss前需要创建cluster_config.xml文件。cluster_config.xml文件包含部署openGauss的服务器信息、安装路径、IP地址以及端口号等。用于告知openGauss如何部署。用户需根据不同场景配置对应的XML文件。
如果是openEuler的操作系统(openEuler
20.03),执行如下命令打开performance.sh文件,用#注释sysctl
-w vm.min_free_kbytes=112640 &> /dev/null,键入“ESC”键进入指令模式,执行 :wq 保存并退出修改。
vi
/etc/profile.d/performance.sh
vi /opt/software/openGauss/cluster_config_template.xml
##目录不需要提前创建,安装时会自动创建
预安装检查
[root@opengaussdb1 script]# python3
gs_preinstall -U omm -G dbgrp -X
/opt/software/openGauss/cluster_config_template.xml
su – omm
安装
gs_install -X
/opt/software/openGauss/cluster_config_template.xml
[omm@opengaussdb1 script]$ gsql -d postgres
-p 26000
gsql ((openGauss 5.1.0 build b5a8d5b0)
compiled at 2023-09-28 00:39:45 commit 0 last mr )
Non-SSL connection (SSL connection is
recommended when requiring high-security)
Type "help" for help.
openGauss=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+-------+-----------+---------+-------+-------------------
postgres
| omm | SQL_ASCII | C | C
|
template0 | omm | SQL_ASCII | C | C
| =c/omm +
| | | |
| omm=CTc/omm
template1 | omm | SQL_ASCII | C | C
| =c/omm +
| | | |
| omm=CTc/omm
(3 rows)
openGauss=# \q
至此安装完成