暂无图片
暂无图片
8
暂无图片
暂无图片
暂无图片

openGauss HA快速安装

原创 贺晓群 2020-07-24
4742

本环境搭建1主1备,1主多备安装类似(目前版本最多1主4备),信息如下:

主机 IP 用途 服务器配置
opengauss01 192.168.210.66 主节点 8C8G 根目录100G
opengauss02 192.168.210.62 备节点 8C8G 根目录100G

实际的生产环境软硬件要求请参考官方文档

1. 各节点主机环境配置(可保存以下脚本到一个shell脚本中一键配置)

#关闭防火墙 systemctl disable firewalld.service systemctl stop firewalld.service #关闭SELINUX sed -i s/SELINUX=enforcing/SELINUX=disabled/g /etc/selinux/config #设置root用户远程登录权限 sed -i s/"PermitRootLogin no"/"PermitRootLogin yes"/g /etc/ssh/sshd_config sed -i s/"PasswordAuthentication no"/"PasswordAuthentication yes"/g /etc/ssh/sshd_config #修改Banner配置 sed -i s/"#Banner none"/"Banner none"/g /etc/ssh/sshd_config #修改字符集 echo 'export LANG=en_US.UTF-8' >> /etc/profile #修改时区 rm -f /etc/localtime cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime #开机自关闭透明大页和交换内存 chmod +x /etc/rc.d/rc.local systemctl enable rc-local.service cat >> /etc/rc.d/rc.local <<EOF swapoff -a if test -f /sys/kernel/mm/transparent_hugepage/enabled; then echo never > /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 #修改主机名,注意根据不同的主机名进行修改**opengauss01** hostnamectl set-hostname opengauss01 #操作系统参数设置 cat>> /etc/sysctl.conf <<EOF net.ipv4.tcp_retries1=5 net.ipv4.tcp_syn_retries=5 net.sctp.path_max_retrans=10 net.sctp.max_init_retransmits=10 EOF echo "* soft nofile 1000000" >> /etc/security/limits.conf echo "* hard nofile 1000000" >> /etc/security/limits.conf echo "* soft nproc 60000" >> /etc/security/limits.d/90-nproc.conf #安装工具包 yum -y install openssl-devel bizp2-devel expat-devel gdbm-devel sqlite-devel libffi-devel libaio-devel lrzsz dos2unix nc telnet ntp wget tree bzip2 flex bison net-tools vim unzip redhat-lsb readline-devel tk-devel gcc make zlib-devel bzip2-devel ncurses-devel #重启服务器 reboot

2. 以下部分手工操作

#创建源安装软件存放目录
mkdir -p /opt/software/openGauss
chmod 755 -R /opt/software

#部署HA环境需要设置同步时间一致,如果无法访问外网时间同步到内网的一台机器,如果能访问外网就直接加个定时器定时同步时间

#安装openssl-1.1.1
#下载openssl-1.1.1
cd /opt/software/openGauss
tar xf openssl-1.1.1.tar.gz
cd openssl-1.1.1
./config --prefix=/usr/local/openssl-1.1.1 shared zlib
make -j 4
make -j 4 install
mv /usr/bin/openssl /usr/bin/openssl.old
ln -s /usr/local/openssl-1.1.1/bin/openssl /usr/bin/openssl
ln -s /usr/local/openssl-1.1.1/lib/libssl.so.1.1 /usr/lib64/libssl.so.1.1
ln -s /usr/local/openssl-1.1.1/lib/libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1

#安装python3
cd /opt/software/openGauss
#下载Python-3.6.11
tar xJf Python-3.6.11.tar.xz
cd Python-3.6.11/Modules
#修改Setup.dist,取消下面几行的注释,修改SSL=/usr/local/openssl-1.1.1
_socket socketmodule.c
SSL=/usr/local/openssl-1.1.1
_ssl _ssl.c
-DUSE_SSL -I(SSL)/includeI(SSL)/include -I(SSL)/include/openssl
-L$(SSL)/lib -lssl -lcrypto

cd …
./configure --prefix=/usr/local/python3 --enable-shared --enable-optimizations
make -j 4
make -j 4 install
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
ln -s /usr/local/python3/lib/libpython3.6m.so.1.0 /usr/lib64/libpython3.6m.so.1.0

#验证Python3安装,以下显示正常

[root@opengauss01 script]# python3 Python 3.6.11 (default, Jul 24 2020, 14:57:55) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import ssl >>> import _ssl

3.本地编辑安装配置文件clusterconfig_HA.xml

<?xml version="1.0" encoding="UTF-8"?> <ROOT> <!-- openGauss 整体信息 --> <CLUSTER> <PARAM name="clusterName" value="dbCluster" /> <PARAM name="nodeNames" value="opengauss01,opengauss02" /> <PARAM name="backIp1s" value="192.168.210.66,192.168.210.62"/> <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="opengauss01"/> <PARAM name="azName" value="AZ1"/> <PARAM name="azPriority" value="1"/> <!-- 如果服务器只有一个网卡可用,将 backIP1 和 sshIP1 配置成同一个 IP --> <PARAM name="backIp1" value="192.168.210.66"/> <PARAM name="sshIp1" value="192.168.210.66"/> <!-- dbnode --> <PARAM name="dataNum" value="1"/> <PARAM name="dataPortBase" value="8832"/> <PARAM name="dataNode1" value="/opt/opengauss/data,opengauss02,/opt/opengauss/data"/> </DEVICE> <!-- node2 上的节点部署信息,其中 name 的值配置为主机名称 --> <DEVICE sn="1000002"> <PARAM name="name" value="opengauss02"/> <PARAM name="azName" value="AZ1"/> <PARAM name="azPriority" value="1"/> <!-- 如果服务器只有一个网卡可用,将 backIP1 和 sshIP1 配置成同一个 IP --> <PARAM name="backIp1" value="192.168.210.62"/> <PARAM name="sshIp1" value="192.168.210.62"/> </DEVICE> </DEVICELIST> </ROOT>

4. 安装openGauss

#上传安装包和XML配置文件到/opt/software/openGauss目录
#解压安装包
cd /opt/software/openGauss
tar -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/script
python3 gs_preinstall -U omm -G dbgrp -X /opt/software/openGauss/clusterconfig_HA.xml

#安装
su - omm
gs_install -X /opt/software/openGauss/clusterconfig_HA.xml
–gsinit-parameter="–encoding=UTF8"
–gsinit-parameter="–locale=zh_CN.UTF8"
-l /tmp/gs_install.log

5. 安装验证

[omm@opengauss01 ~]$ gs_om -t status --detail [ Cluster State ] cluster_state : Normal redistributing : No current_az : AZ_ALL [ Datanode State ] node node_ip instance state ------------------------------------------------------------------------ 1 opengauss01 192.168.210.66 6001 /opt/opengauss/data P Primary Normal 2 opengauss02 192.168.210.62 6002 /opt/opengauss/data S Standby Normal

6. 安装过程碰到的一些问题

1、XML解析错误,因为参考了别人的XML,后面发现别人的就是错的,标签没有结束
[GAUSS-51234] : The configuration file [/opt/software/openGauss/clusterconfig.xml] contains parsing errors. Error:
[GAUSS-51236] : Failed to parsing xml. Error:
mismatched tag: line 14, column 6.

2、gs_preinstall加了-L参数提示下面错误,应该需要先创建用户和组,不然就要加-L参数
[GAUSS-50300] : User omm does not exist.Detail msg: “getpwnam(): name not found: ‘omm’”

3、安装是少安装了一些必须的第三方包
[GAUSS-51405] : You need to install software:[‘bzip2’]

4、安装时没有使用omm用户和dbgrp,报了如下错误
[GAUSS-50102] : The /opt/opengauss/log/testuser is not writable for testuser.

5、export LANG=Unicode,这里应该设置为具体编码,例如:export LANG=en_US.UTF-8
[GAUSS-51632] : Failed to do python3 ‘/opt/software/openGauss/script/local/LocalCheckOS.py’ -t Check_Firewall_Service -l ‘/opt/opengauss/log/omm/om/gs_local.log’ . Error:
‘ascii’ codec can’t decode byte 0xe2 in position 0: ordinal not in range(128).

6、输入互信root密码是正确的,但是提示下面的错误,openssl和Python3安装问题,按照上面安装解决
【GAUSS-52200】: Unalbe to import module: No module named ‘_ssl’.

最后修改时间:2020-07-29 09:23:11
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
1人已赞赏
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论