OpenGauss v6.0.2集中式1主2从部署指南
1.安装说明
无论是采用实体机或者虚拟机,例如VMware虚拟机,或者其他虚拟机。
本指南是采用VMware 安装OpenEuler 22.03-LTS-SP4-x86_64是基于Linux内核的64位操作系统版本。
注意:openEuler 22.03-LTS默认是Linux内核版本为5.10
请依据从上到下安装配置顺序。
2.操作系统调优兼容
2.1.lvm配置
pvcreate /dev/sdb
vgcreate vgdata /dev/sdb
lvcreate -n datalv -L 200g vgdata
mkfs.xfs -i size=2048 /dev/mapper/vgdata-datalv
cat >> /etc/fstab <<EOF
/dev/mapper/vgdata-datalv /opengauss xfs defaults,noatime 0 0
EOF
mkdir /opengauss
mount -a
2.2.光盘本地yum源
cat > /etc/yum.repos.d/localopenEuler.reppo <<EOF
[local-openeuler]
name=Local openEuler 22.03 Repository
baseurl=file:///mnt
enabled=1
gpgcheck=1
gpgkey=file:///mnt/RPM-GPG-KEY-openEuler
EOF
dnf clean all
dnf makecache
2.3.安装兼容依赖包
dnf install -y libaio-devel readline-devel expect
2.4.关闭安全设置
vi /etc/selinux/config
#SELINUX=enforcing
SELINUX=disabled
systemctl stop firewalld
systemctl disable firewalld
2.5.输出编码环境
vi /etc/profile
export LANG=en.UTF8
2.6.时间设置
date
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
data -s "Sat Sep 27 16:00:07 CST 2020"
2.7.RemoveIPC设置
echo "RemoveIPC=no" >>/etc/systemd/logind.conf
systemctl daemon-reload
systemctl restart systemd-logind
[root@opengauss600 yum.repos.d]# loginctl show-session |grep RemoveIPC
RemoveIPC=no
[root@opengauss600 yum.repos.d]# systemctl show systemd-logind |grep RemoveIPC
RemoveIPC=no
2.8.关闭HISTORY记录
echo "HISTSIZE=0" >> /etc/profile
source /etc/profile
cat >> /etc/sysctl.conf <<EOF
net.ipv4.tcp_retries1 = 5
net.ipv4.tcp_syn_retries = 5
net.ipv4.tcp_synack_retries = 5
net.ipv4.tcp_fin_timeout = 60
net.ipv4.ip_local_port_range = 26000 65535
net.ipv4.tcp_sack = 1
net.ipv4.tcp_timestamps = 1
vm.extfrag_threshold = 500
vm.overcommit_ratio = 90
EOF
2.9.设置用户限制
echo "omm soft nofile 1000000" >> /etc/security/limits.conf
echo "omm hard nofile 1000000" >> /etc/security/limits.conf
echo "omm soft nproc unlimited" >> /etc/security/limits.conf
echo "omm hard nproc unlimited" >> /etc/security/limits.conf
echo "omm soft stack 3072" >> /etc/security/limits.conf
echo "omm hard stack 3072" >> /etc/security/limits.conf
2.10.创建用户和组
groupadd dbgrp
useradd -g dbgrp omm
echo "omm" |passwd --stdin omm
chown -R omm:dbgrp /opengauss
chmod -R 777 /opengauss
mkdir -p /opengauss/log/omm
mkdir -p /opengauss/tmp
mkdir -p /opengauss/app/om
mkdir -p /opengauss/corefile
mkdir -p /opengauss/data/dn
mkdir -p /opengauss/data/cmserver
2.11.hosts文件配置
cat >> /etc/hosts <<EOF
192.168.79.11 gauss01
192.168.79.12 gauss02
192.168.79.13 gauss03
EOF
2.12.omm用户的crontab使用权限
sh -c 'echo "omm" >> /etc/cron.allow'
3.获取安装包
cd ~
tar -zxvf openGauss-All-6.0.2-openEuler22.03-x86_64.tar.gz -C /opengauss/soft
cd /opengauss/soft/ && ls -lsa
openGauss-CM-6.0.2-openEuler22.03-x86_64.sha256
openGauss-CM-6.0.2-openEuler22.03-x86_64.tar.gz
openGauss-OM-6.0.2-openEuler22.03-x86_64.sha256
openGauss-OM-6.0.2-openEuler22.03-x86_64.tar.gz
openGauss-Server-6.0.2-openEuler22.03-x86_64.sha256
openGauss-Server-6.0.2-openEuler22.03-x86_64.tar.bz2
upgrade_sql.sha256
upgrade_sql.tar.gz
4.解压安装包和权限
su - root
chown -R omm:dbgrp /opengauss
chmod -R 777 /opengauss
su - omm
cd /opengauss/soft
tar -zxvf openGauss-OM-6.0.2-openEuler22.03-x86_64.tar.gz
tar -jxvf openGauss-Server-6.0.2-openEuler22.03-x86_64.tar.bz2
5.Cluster_config.xml配置文件
vi /opengauss/cluster_config.xml<?xml version="1.0" encoding="UTF-8"?><ROOT> <CLUSTER> <PARAM name="clusterName" value="gaussdbcluster" /> <PARAM name="nodeNames" value="gauss01,gauss02,gauss03" /> <PARAM name="gaussdbAppPath" value="/opengauss/app/opengauss" /> <PARAM name="gaussdbLogPath" value="/opengauss/log/omm" /> <PARAM name="tmpMppdbPath" value="/opengauss/tmp"/> <PARAM name="gaussdbToolPath" value="/opengauss/app/om" /> <PARAM name="corePath" value="/opengauss/corefile" /> <PARAM name="backIp1s" value="192.168.79.11,192.168.79.12,192.168.79.13"/> </CLUSTER> <DEVICELIST> <DEVICE sn="gauss01"> <PARAM name="name" value="gauss01"/> <PARAM name="azName" value="AZ1"/> <PARAM name="azPriority" value="1"/> <PARAM name="backIp1" value="192.168.79.11"/> <PARAM name="sshIp1" value="192.168.79.11"/> <PARAM name="cmsNum" value="1"/> <PARAM name="cmServerPortBase" value="15000"/> <PARAM name="cmServerListenIp1" value="192.168.79.11,192.168.79.12,192.168.79.13"/> <PARAM name="cmServerHaIp1" value="192.168.79.11,192.168.79.12,192.168.79.13"/> <PARAM name="cmServerLevel" value="1"/> <PARAM name="cmServerRelation" value="gauss01,gauss02,gauss03"/> <PARAM name="cmDir" value="/opengauss/data/cmserver"/> <PARAM name="dataNum" value="1"/> <PARAM name="dataPortBase" value="15400"/> <PARAM name="dataNode1" value="/opengauss/data/dn,gauss02,/opengauss/data/dn,gauss03,/opengauss/data/dn"/> <PARAM name="dataNode1_syncNum" value="0"/> </DEVICE> <DEVICE sn="gauss02"> <PARAM name="name" value="gauss02"/> <PARAM name="azName" value="AZ1"/> <PARAM name="azPriority" value="1"/> <PARAM name="backIp1" value="192.168.79.12"/> <PARAM name="sshIp1" value="192.168.79.12"/> <PARAM name="cmServerPortStandby" value="15000"/> <PARAM name="cmDir" value="/opengauss/data/cmserver"/> </DEVICE> <DEVICE sn="gauss03"> <PARAM name="name" value="gauss03"/> <PARAM name="azName" value="AZ1"/> <PARAM name="azPriority" value="1"/> <PARAM name="backIp1" value="192.168.79.13"/> <PARAM name="sshIp1" value="192.168.79.13"/> <PARAM name="cmServerPortStandby" value="15000"/> <PARAM name="cmDir" value="/opengauss/data/cmserver"/> </DEVICE> </DEVICELIST></ROOT> |
6.预安装OpenGauss数据库集群
cd /opengauss/soft/script/
./gs_preinstall -U omm -G dbgrp -X /opengauss/cluster_config.xml
7.正式安装OpenGauss数据库集群
gs_install -X /opengauss/cluster_config.xml
8.登录OpenGauss数据库集群
[omm@gauss01 ~]$ gs_om -t status --detail[ CMServer State ]node node_ip instance state--------------------------------------------------------------------------1 gauss01 192.168.79.11 1 /opengauss/data/cmserver/cm_server Primary2 gauss02 192.168.79.12 2 /opengauss/data/cmserver/cm_server Standby3 gauss03 192.168.79.13 3 /opengauss/data/cmserver/cm_server Standby[ Cluster State ]cluster_state : Normalredistributing : Nobalanced : Yescurrent_az : AZ_ALL[ Datanode State ]node node_ip instance state ---------------------------------------------------------------------------1 gauss01 192.168.79.11 6001 15400 /opengauss/data/dn P Primary Normal2 gauss02 192.168.79.12 6002 15400 /opengauss/data/dn S Standby Normal3 gauss03 192.168.79.13 6003 15400 /opengauss/data/dn S Standby Normal[omm@gauss01 ~]$[omm@gauss01 ~]$[omm@gauss01 ~]$ gsql -d postgres -h 192.168.79.11 -p 15400 -U ommgsql: FATAL: Forbid remote connection with trust method!FATAL: Forbid remote connection with trust method!more /opengauss/data/dn/pg_hba.conf# TYPE DATABASE USER ADDRESS METHOD# "local" is for Unix domain socket connections onlylocal all all trusthost all omm 192.168.79.11/32 trusthost all omm 192.168.79.12/32 trusthost all omm 192.168.79.13/32 trust# IPv4 local connections:host all all 127.0.0.1/32 trusthost all all 192.168.79.11/32 sha256host all all 192.168.79.12/32 sha256host all all 192.168.79.13/32 sha256# IPv6 local connections:host all all ::1/128 trust# Allow replication connections from localhost, by a user with the# replication privilege.#local replication omm trust#host replication omm 127.0.0.1/32 trust#host replication omm ::1/128 trust[omm@gauss01 ~]$[omm@gauss01 ~]$[omm@gauss01 ~]$ gsql -d postgres -p 15400 -U ommgsql ((openGauss 6.0.2 build 6285c0ef) compiled at 2025-07-15 17:31:11 commit 0 last mr 8059 )Non-SSL connection (SSL connection is recommended when requiring high-security)Type "help" for help.openGauss=# |
浙公网安备 33010602011771号