环境准备
主机ip |
配置 |
用途 |
10.0.61.190 |
Centos7.6 1C/8G/50G | 主节点 |
10.0.61.191 | Centos7.6 1C/8G/50G | 从节点 |
安装前置操作
关闭防火墙
systemctl disable firewalld.servicesystemctl stop firewalld.service
关闭SELINUX
sed -i s/SELINUX=enforcing/SELINUX=disabled/g /etc/selinux/config
禁用swap
swapoff -avswapoff /dev/mapper/rhel-swap
设置主机互信
ssh-keygen -t rsassh-copy-id root@ip
操作系统参数设置
echo "* soft nofile 65535" >> /etc/security/limits.confecho "* hard nofile 65535" >> /etc/security/limits.confecho "* soft nproc 65535" >> /etc/security/limits.d/90-nproc.conf
安装依赖工具包
yum -y install openssl-devel bizp2-devel expat-devel gdbm-devel sqlite-devel l
安装openssl-1.1.1
#下载openssl-1.1.1:https://www.openssl.org/source/openssl-1.1.1.tar.gzcd /opt/software/openGausstar xf openssl-1.1.1.tar.gzcd openssl-1.1.1./config --prefix=/usr/local/openssl-1.1.1 shared zlibmake -j 4make -j 4 installmv /usr/bin/openssl /usr/bin/openssl.oldln -s /usr/local/openssl-1.1.1/bin/openssl /usr/bin/opensslln -s /usr/local/openssl-1.1.1/lib/libssl.so.1.1 /usr/lib64/libssl.so.1.1ln -s /usr/local/openssl-1.1.1/lib/libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1
安装python3.6.11
openGauss依赖python3.6.X环境cd /opt/software/openGauss#下载Python-3.6.11:https://www.python.org/ftp/python/3.6.11/Python-3.6.11.tar.xztar xJf Python-3.6.11.tar.xzcd Python-3.6.11/vi Modules/Setup.dist#修改Setup.dist,取消下面几行的注释SSL=/usr/local/openssl-1.1.1_socket socketmodule.cSSL=/usr/local/openssl-1.1.1_ssl _ssl.c-DUSE_SSL -I(SSL)/include−I(SSL)/include/openssl-L$(SSL)/lib -lssl -lcrypto
#编译安装./configure --prefix=/usr/local/python3 --enable-shared --enable-optimizationsmake -j 4make -j 4 installln -s /usr/local/python3/bin/python3 /usr/bin/python3ln -s /usr/local/python3/lib/libpython3.6m.so.1.0 /usr/lib64/libpython3.6m.so.1.0
安装openGauss
创建数据库配置文件
vi clusterconfig_HA.xml
<?xml version="1.0" encoding="UTF-8"?>
<ROOT>
<!-- openGauss 整体信息 -->
<CLUSTER>
<PARAM name="clusterName" value="dbCluster" />
<PARAM name="nodeNames" value="centos76-dev-61-190,centos76-dev-61-191" />
<PARAM name="backIp1s" value="10.0.61.190,10.0.61.191"/>
<PARAM name="gaussdbAppPath" value="/opt/opengauss/app" />
<PARAM name="gaussdbLogPath" value="/opt/opengauss/log" />
<PARAM name="tmpMppdbPath" value="/opt/opengauss/tmp" />
<PARAM name="gaussdbToolPath" value="/opt/opengauss/gausstools/om" />
<PARAM name="corePath" value="/opt/opengauss/corefile" />
<PARAM name="clusterType" value="single-inst"/>
</CLUSTER>
<!-- 每台服务器上的节点部署信息 -->
<DEVICELIST>
<!-- node1 上的节点部署信息 -->
<DEVICE sn="1000001">
<PARAM name="name" value="centos76-dev-61-190"/>
<PARAM name="azName" value="AZ1"/>
<PARAM name="azPriority" value="1"/>
<!-- 如果服务器只有一个网卡可用,将 backIP1 和 sshIP1 配置成同一个 IP -->
<PARAM name="backIp1" value="10.0.61.190"/>
<PARAM name="sshIp1" value="10.0.61.190"/>
<!-- dbnode -->
<PARAM name="dataNum" value="1"/>
<PARAM name="dataPortBase" value="8832"/>
<PARAM name="dataNode1" value="/opt/opengauss/data,centos76-dev-61-191,/opt/opengauss/data"/>
</DEVICE>
<!-- node2 上的节点部署信息,其中 name 的值配置为主机名称 -->
<DEVICE sn="1000002">
<PARAM name="name" value="centos76-dev-61-191"/>
<PARAM name="azName" value="AZ1"/>
<PARAM name="azPriority" value="1"/>
<!-- 如果服务器只有一个网卡可用,将 backIP1 和 sshIP1 配置成同一个 IP -->
<PARAM name="backIp1" value="10.0.61.191"/>
<PARAM name="sshIp1" value="10.0.61.191"/>
</DEVICE>
</DEVICELIST>
</ROOT>
上传安装包和XML配置文件到/opt/software/openGauss目录
解压安装包
cd /opt/software/openGausstar -zxf openGauss-1.0.0-CentOS-64bit.tar.gz
设置lib库
export LD_LIBRARY_PATH=/opt/software/openGauss/script/gspylib/clib:$LD_LIBRARY_PATH
交互式HA环境检测及设置
确保两节点时间同步
cd /opt/software/openGauss/scriptpython3 gs_preinstall -U omm -G dbgrp -X /opt/software/openGauss/clusterconfig_ha.xml
初始化安装
su - ommgs_install -X /opt/software/openGauss/clusterconfig_ha.xml -l /tmp/gs_install.log
#安装过程中设置密码
必须包含三种字符
至少8个字符以上
安装后检查
[omm@centos76-dev-61-190 ~]$ gs_om -t status --detail
[ Cluster State ]
cluster_state : Normal
redistributing : No
current_az : AZ_ALL
[ Datanode State ]
node node_ip instance state
------------------------------------------------------------------------
1 centos76-dev-61-190 10.0.61.190 6001 /opt/opengauss/data P Primary Normal
2 centos76-dev-61-190 10.0.61.191 6002 /opt/opengauss/data S Standby Normal