m6米乐安卓版下载-米乐app官网下载
暂无图片
67
暂无图片
暂无图片
暂无图片

天龙八部之centos/rhel 7 安装部署opengauss 5.0 企业版 一主二备一级联操作指南 -m6米乐安卓版下载

1373

前言: 写此文章的目的主要是感觉opengaussm6米乐安卓版下载官网对企业版集群安装部署描述有些冗杂,相信很多初次接触opengauss的朋友估计看了官方文档也是要琢磨好久,而且通过实操发现官方文档里对有些地方描述是有问题的,所以希望能编写一篇 5.0的安装部署文档,希望对openguass初次接触的朋友也能照着这篇文章一次部署起来,如果在部署中对此文档有异议的地方,请私信我,我好进一步完善修改。

集群环境各服务器应具有相同体系架构

  • 64bit 和 32bit 不能同一集群
  • arm 和 x86 两类系统不能同一集群

1.1 硬件环境要求

集群环境opengauss各服务器应满足以下最低硬件需求,生产环境应根据业务需求适时调整硬件配置。

项目名称 配置描述 备注信息
服务器数量 4(台)
内存 >=32(gb) 性能及商业部署建议单机不低于128(gb)
cpu >= 1 * 8(核),2.0(ghz) 性能及商业部署建议单机不低于1*16(核),2.0(ghz)
支持超线程和非超线程两种模式,建议选择相同模式
硬盘 > 1(gb) 存放opengauss应用程序
> 300(mb) 存放元数据
> 70(%) 存储空间存放数据库数据
系统盘建议配置raid1
数据盘建议配置raid5(规划4组raid5数据盘安装opengauss)
disk cache policy建议设置disabled
网络 >= 300(兆) 以太网 建议设置双网卡冗余bond

1.2 操作系统要求

1.2.1 软件环境要求

软件类型 配置描述 备注信息
操作系统 x86操作系统
centos 7.6及以上
生产建议选择centos 7系列
inode个数 剩余inode个数>15(亿)
工具 bzip2
python python 3.6.x python需要通过–enable-shared方式编译

1.2.2 软件依赖要求

所需软件 建议版本 备注信息
libaio-devel 建议版本:0.3.109-13
flex 要求版本:2.5.31 以上
bison 建议版本:2.7-4
ncurses-devel 建议版本:5.9-13.20130511
glibc-devel 建议版本:2.17-111
patch 建议版本:2.7.1-10
redhat-lsb-core 建议版本:4.1
readline-devel 建议版本:7.0-13

2.1 主机名称规划

主机名称 描述说明
xsky-node1 主节点服务器名称
xsky-node2 备节点一服务器名称
xsky-node3 备节点二服务器名称
xsky-node4 级联节点服务器名称

2.2 主机地址规划

ip地址 描述说明
10.110.7.39 主节点ip地址
10.110.7.40 备节点一ip地址
10.110.7.41 备节点二ip地址
10.110.7.42 级联节点ip地址

2.3 端口号规划

端口号 参数名称 描述说明
15300 cmserverportbase 主cm server端口号
15300 cmserverportstandby 备cm server端口号
26000 dataportbase 数据库节点的基础端口号

2.4 用户及组规划

项目名称 名称 所属类型 规划建议
用户名 omm 操作系统 建议集群各节点密码及id相同
组名 dbgrp 操作系统 建议集群各节点组id相同

2.5 软件目录规划

目录名称 对应名称 目录作用
/opt/software/opengauss software 安装软件存放目录
/opt/gaussdb/install/app gaussdbapppath 数据库安装目录
/var/log/omm gaussdblogpath 日志目录
/opt/gaussdb/tmp tmpmppdbpath 临时文件目录
/opt/gaussdb/install/om gaussdbtoolpath 数据库工具目录
/opt/gaussdb/corefile corepath 数据库core文件目录
/opt/gaussdb/data/cmserver cmdir cm数据目录
/opt/gaussdb/install/data/dn datanode 数据库主备节点数据目录

3.1 安装python

本次安装选择python 3.6.10版本,使用–enable-shared方式编译。

# root用户执行【所有节点】 -- 安装依赖包 [root@xsky-nodexxx ~]# yum install -y gcc-c pcre pcre-devel zlib zlib-devel openssl openssl-devel -- 创建安装目录 [root@xsky-nodexxx ~]# mkdir /usr/local/python3 [root@xsky-nodexxx ~]# cd /home/soft -- 如服务器可以连接网络,可通过wget获取安装包,如无法联网,可下载安装包并上传至服务器 [root@xsky-nodexxx soft]# wget https://www.python.org/ftp/python/3.6.10/python-3.6.10.tar.xz -- 解压源码包 [root@xsky-nodexxx soft]# tar xvjf python-3.6.10.tar.xz [root@xsky-nodexxx soft]# cd python-3.6.10 -- 配置编译参数 [root@xsky-nodexxx python-3.6.10]# ./configure --prefix=/usr/local/python3 --enable-optimizations --enable-shared cflags=-fpic --with-ssl -- 执行安装 [root@xsky-nodexxx python-3.6.10]# make && make install -- 创建链接 [root@xsky-nodexxx python-3.6.10]# ln -s /usr/local/python3/bin/python3 /usr/bin/python3 -- 检验python版本 [root@xsky-nodexxx ~]# python3 python 3.6.10 (default, jul 12 2023, 17:08:53) [gcc 4.8.5 20150623 (red hat 4.8.5-44)] on linux type "help", "米乐app官网下载 copyright", "credits" or "license" for more information. >>>

3.2 安装软件依赖包

# root用户执行【所有节点】 [root@xsky-nodexxx ~]# yum install -y libaio-devel flex bison ncurses-devel glibc-devel patch redhat-lsb-core readline-devel zlib readline -- 检查是否已安装 [root@xsky-nodexxx ~]# rpm -qa --queryformat "%{name}-%{version}-%{release} (%{arch})\n" | grep -e "libaio-devel|flex|bison|ncurses-devel|glibc-devel|patch|redhat-lsb-core|readline-devel|zlib|readline|expect"

3.3 关闭防火墙

# root用户执行【所有节点】 -- 停止 firewalld 服务 [root@xsky-nodexxx ~]# systemctl stop firewalld.service -- 禁用 firewalld 服务 [root@xsky-nodexxx ~]# systemctl disable firewalld.service -- 查看 firewalld 服务状态 [root@xsky-nodexxx ~]# systemctl status firewalld -- 显示如下表示已关闭禁用防火墙 ● firewalld.service - firewalld - dynamic firewall daemon loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled) active: inactive (dead) docs: man:firewalld(1)

3.4 关闭selinux

# root用户执行【所有节点】 -- 临时关闭selinux [root@xsky-nodexxx ~]# setenforce 0 -- 永久关闭selinux [root@xsky-nodexxx ~]# sed -i "s/selinux=enforcing/selinux=disabled/" /etc/selinux/config -- 检查selinux状态 [root@xsky-nodexxx ~]# getenforce -- 状态为disabled表明selinux已关闭 disabled

3.5 修改字符集

# root用户执行【所有节点】 [root@xsky-nodexxx ~]# cat>> /etc/profile<

3.6 设置时区和时间

# root用户执行【所有节点】 # 使用ntp设置时钟同步 -- 安装ntp服务 [root@xsky-nodexxx ~]# yum install -y ntp -- 开机启动ntp服务 [root@xsky-nodexxx ~]# systemctl enable ntpd -- 启动ntp服务 [root@xsky-nodexxx ~]# systemctl start ntpd -- 设置时区asia/shanghai [root@xsky-nodexxx ~]# timedatectl set-timezone asia/shanghai -- 检查时区 [root@xsky-nodexxx ~]# timedatectl |grep -i zone -- 启用ntp服务 [root@xsky-nodexxx ~]# timedatectl set-ntp yes -- 编辑定时任务列表 [root@xsky-nodexxx ~]# crontab -e -- 使用vi/vim对定时任务列表进行编辑,添加如下内容变保存退出 0 12 * * * ntpdate cn.pool.ntp.org -- 查看时间及时区 [root@xsky-nodexxx ~]# timedatectl status

3.7 修改硬件时钟

# root用户执行【所有节点】 -- 将当前系统时间写入硬件时钟 [root@xsky-nodexxx ~]# hwclock --systohc -- 查看硬件时钟 [root@xsky-nodexxx ~]# hwclock

3.8 关闭swap

# root用户执行【所有节点】 -- 禁用当前的 swap 分区 [root@xsky-nodexxx ~]# swapoff -a # 永久关闭swap 分区 -- 使用vi/vim编辑 /etc/fstab 文件,注释如下内容 uuid= swap swap defaults 0 0 -- 保存退出,下次重启会生效

3.9 设置网卡mtu

# root用户执行【所有节点】 -- 查看网卡列表 [root@xsky-nodexxx ~]# ip addr -- 假设网卡名称为eth0,设置网卡mtu,mtu值推荐8192,要求不小于1500 [root@xsky-nodexxx ~]# ip link set dev eth0 mtu 8192 -- 查看网卡mtu [root@xsky-nodexxx ~]# ifconfig -a |grep -i mtu

3.10 关闭透明大页

# root用户执行【所有节点】 [root@xsky-nodexxx ~]# 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 -- 更新 grub 配置以使更改生效 [root@xsky-nodexxx ~]# grub2-mkconfig -o /boot/grub2/grub.cfg -- 重启操作系统生效 [root@xsky-nodexxx ~]# shutdown -r 0 -- 查看透明大页是否关闭,如输出显示为 never,则透明大页和透明大页的碎片整理已成功关闭 [root@xsky-nodexxx ~]# cat /sys/kernel/mm/transparent_hugepage/enabled [root@xsky-nodexxx ~]# cat /sys/kernel/mm/transparent_hugepage/defrag

3.11 设置root用户远程登陆

# root用户执行【所有节点】 [root@xsky-nodexxx ~]# cat >>/etc/ssh/sshd_config<

3.12 配置ssh

# root用户执行【所有节点】 -- 禁用 ssh 登录时的横幅(banner) [root@xsky-nodexxx ~]# sed -i '/banner/s/^/#/' /etc/ssh/sshd_config -- 目的是禁用允许以 root 用户登录的配置选项 [root@xsky-nodexxx ~]# sed -i '/permitrootlogin/s/^/#/' /etc/ssh/sshd_config [root@xsky-nodexxx ~]# echo -e "\n" >> /etc/ssh/sshd_config [root@xsky-nodexxx ~]# echo "banner none " >> /etc/ssh/sshd_config # 修改banner配置,去掉连接到系统时,系统提示的欢迎信息。欢迎信息会干扰安装时远程操作的返回结果,影响安装正常执行 [root@xsky-nodexxx ~]# echo "permitrootlogin yes" >> /etc/ssh/sshd_config [root@xsky-nodexxx ~]# cat /etc/ssh/sshd_config |grep -v ^#|grep -e 'permitrootlogin|banner' -- 重启生效 [root@xsky-nodexxx ~]# systemctl restart sshd.service -- 查看ssh状态 [root@xsky-nodexxx ~]# systemctl status sshd.service

3.13 添加hosts解析

# root用户执行【所有节点】 [root@xsky-nodexxx ~]# cat >> /etc/hosts<

3.14 调整系统内核参数

如下系统内核参数预安装时脚本未进行自动设置,需通过手工调整。

参数名称 参数说明 推荐取值
net.ipv4.tcp_retries1 在连接建立过程中tcp协议最大重试次数 5
net.ipv4.tcp_syn_retries tcp协议syn报文最大重试次数 5
net.ipv4.tcp_synack_retries tcp协议syn应答报文最大重试次数 5
net.ipv4.ip_local_port_range 物理机可用临时端口范围 26000-65535
net.ipv4.tcp_fin_timeout 系统默认的超时时间 60
net.ipv4.tcp_sack 此参数用于启用或禁用tcp的sack功能,sack允许接收端向发送端告知它已经成功接收哪些数据包,从而提高tcp传输效率
0 表示关闭
1 表示开启
1
net.ipv4.tcp_timestamps 此参数用于启用或禁用tcp的时间戳功能,可提高tcp传输精度和效率
0 表示关闭
1 表示开启
1
vm.overcommit_ratio 此参数定义了内存过量分配的比例,当这个比例超过100%时,内核会允许进程分配超过实际可用内存的内存 90
vm.extfrag_threshold 此参数定义了内存碎片的阈值,当内存碎片超过这个阈值时,内核会尝试进行碎片整理以提高内存利用率 500
# root用户执行【所有节点】 [root@xsky-nodexxx ~]# tee -a /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 -- 然后执行sysctl -p使修改生效 [root@xsky-nodexxx ~]# sysctl -p

3.15 创建目录

# root用户执行【主节点】 [root@xsky-nodexxx ~]# mkdir -p /opt/software/opengauss [root@xsky-nodexxx ~]# chmod 755 -r /opt/software

3.16 下载软件安装包

3.16.1 下载安装包

使用注册账号登录openguassm6米乐安卓版下载官网https://www.opengauss.org/zh/download/下载页面,下载与操作系统匹配的opengauss 5.0.0软件安装包,选择opengauss_5.0.0 企业版下载,并将下载的软件包上传至服务器/opt/software/opengauss目录下。

image20230714172434764.png

注:可用鼠标右键点击image20230714172728888.png,然后选择“复制链接”,如数据库服务器可连外网,可在服务器上通过wget获取opengauss 5.0.0企业版软件安装包。

[root@xsky-node1 ~]# cd /opt/software/opengauss [root@xsky-node1 opengauss]# wget https://opengauss.obs.cn-south-1.myhuaweicloud.com/5.0.0/x86/opengauss-5.0.0-centos-64bit-all.tar.gz

3.16.2 校验安装包

点击上图image20230714174335510.pngimage20230714174348323.png,将复制的内容粘贴到文本文件,显示内容为:aa9fc724c5030f4cc79dad201675183029c8f36a07667028e681169a2f6482f5,然后将下载的文件通过sha256sum命令进行校验,已确保下载安装包完整性。

# root用户执行【主节点】 [root@xsky-node1 opengauss]# sha256sum opengauss-5.0.0-centos-64bit-all.tar.gz aa9fc724c5030f4cc79dad201675183029c8f36a07667028e681169a2f6482f5 opengauss-5.0.0-centos-64bit-all.tar.gz -- 如校验的值和m6米乐安卓版下载官网sha256值相同,表明文件完整

3.16.3 解压安装包

# root用户执行【主节点】 [root@xsky-node1 opengauss]# tar -zxvf opengauss-5.0.0-centos-64bit-all.tar.gz [root@xsky-node1 opengauss]# tar -zxvf opengauss-5.0.0-centos-64bit-om.tar.gz [root@xsky-node1 opengauss]# ll total 261040 drwxr-xr-x 14 root root 302 mar 29 03:22 lib -rw-r--r-- 1 root root 133071038 mar 29 20:11 opengauss-5.0.0-centos-64bit-all.tar.gz -rw-r--r-- 1 root root 105 mar 29 03:23 opengauss-5.0.0-centos-64bit-cm.sha256 -rw-r--r-- 1 root root 22356000 mar 29 03:23 opengauss-5.0.0-centos-64bit-cm.tar.gz -rw-r--r-- 1 root root 65 mar 29 03:22 opengauss-5.0.0-centos-64bit-om.sha256 -rw-r--r-- 1 root root 11963876 mar 29 03:22 opengauss-5.0.0-centos-64bit-om.tar.gz -rw-r--r-- 1 root root 65 mar 29 03:23 opengauss-5.0.0-centos-64bit.sha256 -rw-r--r-- 1 root root 99384569 mar 29 03:23 opengauss-5.0.0-centos-64bit.tar.bz2 drwxr-xr-x 10 root root 4096 mar 29 03:22 script -rw------- 1 root root 65 mar 29 03:21 upgrade_sql.sha256 -rw------- 1 root root 493211 mar 29 03:21 upgrade_sql.tar.gz -rw-r--r-- 1 root root 32 mar 29 03:22 version.cfg

3.17 建立互信

此处使用脚本建立root互信,也可手工建立互信,建立互信前将集群各节点root用户设置为相同口令。

# root用户执行【主节点】 -- 1) 在主节点创建sshtrust.sh互信脚本 [root@xsky-node1 ~]# tee -a /root/sshtrust.sh << eof #!/bin/bash hostlist=" xsky-node1 xsky-node2 xsky-node3 xsky-node4" # 依赖sshpass包,使用前先rpm -qa|grep sshpass,若无回显则需要安装 rpm -q sshpass &> /dev/null || yum -y install sshpass [ -f /root/.ssh/id_rsa ] || ssh-keygen -f /root/.ssh/id_rsa -p '' export sshpass=root for host in $hostlist; do { hostname=$(getent hosts $host | awk '{ print $2 }') sshpass -e ssh-copy-id -o stricthostkeychecking=no root@$hostname # 拷贝主节点/root/.ssh 目录到其他节点 scp -r /root/.ssh root@$hostname:/root } & done wait eof -- 2) 授权/root/sshtrust.sh [root@xsky-node1 ~]# chmod x /root/sshtrust.sh -- 3) 执行/root/sshtrust.sh [root@xsky-node1 ~]# sh sshtrust.sh generating public/private rsa key pair. created directory '/root/.ssh'. your identification has been saved in /root/.ssh/id_rsa. your public key has been saved in /root/.ssh/id_rsa.pub. the key fingerprint is: sha256:p8d8j8lyj2iwpf1mgwfx62pbr9mjvxx1hsdbcpezjry root@xsky-node1 the key's randomart image is: ---[rsa 2048]---- | ooe.o | | . .b . | | . o .* ... | | o o. .o| | s . o| | . .# . . | | *o.o o | | o. *o= o | | .. b o . | ----[sha256]----- /usr/bin/ssh-copy-id: info: attempting to log in with the new key(s), to filter out any that are already installed /usr/bin/ssh-copy-id: info: attempting to log in with the new key(s), to filter out any that are already installed /usr/bin/ssh-copy-id: info: attempting to log in with the new key(s), to filter out any that are already installed /usr/bin/ssh-copy-id: info: attempting to log in with the new key(s), to filter out any that are already installed /usr/bin/ssh-copy-id: info: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys /usr/bin/ssh-copy-id: info: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys /usr/bin/ssh-copy-id: info: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys /usr/bin/ssh-copy-id: info: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys number of key(s) added: 1 now try logging into the machine, with: "ssh -o 'stricthostkeychecking=no' 'root@xsky-node1'" and check to make sure that only the key(s) you wanted were added. number of key(s) added: 1 now try logging into the machine, with: "ssh -o 'stricthostkeychecking=no' 'root@xsky-node4'" and check to make sure that only the key(s) you wanted were added. number of key(s) added: 1 now try logging into the machine, with: "ssh -o 'stricthostkeychecking=no' 'root@xsky-node2'" and check to make sure that only the key(s) you wanted were added. number of key(s) added: 1 now try logging into the machine, with: "ssh -o 'stricthostkeychecking=no' 'root@xsky-node3'" and check to make sure that only the key(s) you wanted were added. id_rsa 100% 1679 2.8mb/s 00:00 id_rsa.pub 100% 397 1.1mb/s 00:00 known_hosts 100% 736 2.0mb/s 00:00 authorized_keys 100% 97 263.3kb/s 00:00 id_rsa 100% 1679 3.7mb/s 00:00 id_rsa.pub 100% 397 1.3mb/s 00:00 known_hosts 100% 736 2.0mb/s 00:00 authorized_keys 100% 97 348.7kb/s 00:00 id_rsa 100% 1679 2.8mb/s 00:00 id_rsa.pub 100% 397 783.1kb/s 00:00 known_hosts 100% 736 1.4mb/s 00:00 authorized_keys 100% 97 189.9kb/s 00:00 id_rsa 100% 1679 3.0mb/s 00:00 id_rsa.pub 100% 397 1.0mb/s 00:00 known_hosts 100% 736 1.7mb/s 00:00 authorized_keys 100% 97 281.1kb/s 00:00 -- 4) 测试互信 [root@xsky-node1 ~]# ssh xsky-node2 last login: sun jul 16 00:32:06 2023 from xsky-node1 [root@xsky-node2 ~]# ssh xsky-node3 last login: sun jul 16 00:32:31 2023 from xsky-node1 [root@xsky-node3 ~]# ssh xsky-node4 last login: sun jul 16 00:32:40 2023 from xsky-node3 [root@xsky-node4 ~]# ssh xsky-node1 last login: sun jul 16 00:37:48 2023 [root@xsky-node1 ~]# ssh xsky-node3 last login: sun jul 16 00:38:50 2023 from xsky-node2

3.18 创建xml配置文件

# root用户执行【主节点】 tee -a /opt/software/opengauss/cluster_config.xml << eof eof

四、执行安装

4.1 初始化安装

采用交互式进行初始化安装,创建omm用户并设置互信。

# root用户执行【主节点】 [root@xsky-node1 ~]# cd /opt/software/opengauss/script -- 执行初始化安装 [root@xsky-node1 script]# ./gs_preinstall -u omm -g dbgrp -x /opt/software/opengauss/cluster_config.xml -- 命令执行输出结果如下 parsing the configuration file. successfully parsed the configuration file. installing the tools on the local node. successfully installed the tools on the local node. are you sure you want to create trust for root (yes/no)?yes -- 输入yes please enter password for root password: -- 输入root口令 successfully created ssh trust for the root permission user. setting host ip env successfully set host ip env. distributing package. begin to distribute package to tool path. successfully distribute package to tool path. begin to distribute package to package path. successfully distribute package to package path. successfully distributed package. are you sure you want to create the user[omm] and create trust for it (yes/no)? yes please enter password for cluster user. password: -- 设置omm用户口令 please enter password for cluster user again. password: -- 再次输入omm口令 generate cluster user password files successfully. successfully created [omm] user on all nodes. preparing ssh service. successfully prepared ssh service. installing the tools in the cluster. successfully installed the tools in the cluster. checking hostname mapping. successfully checked hostname mapping. creating ssh trust for [omm] user. please enter password for current user[omm]. password: -- 输入omm用户口令 checking network information. all nodes in the network are normal. successfully checked network information. creating ssh trust. creating the local key file. successfully created the local key files. appending local id to authorized_keys. successfully appended local id to authorized_keys. updating the known_hosts file. successfully updated the known_hosts file. appending authorized_key on the remote node. successfully appended authorized_key on all remote node. checking common authentication file content. successfully checked common authentication content. distributing ssh trust file to all node. distributing trust keys file to all node successfully. successfully distributed ssh trust file to all node. verifying ssh trust on all hosts. successfully verified ssh trust on all hosts. successfully created ssh trust. successfully created ssh trust for [omm] user. checking os software. successfully check os software. checking os version. successfully checked os version. creating cluster's path. successfully created cluster's path. set and check os parameter. setting os parameters. successfully set os parameters. set and check os parameter completed. preparing cron service. successfully prepared cron service. setting user environmental variables. successfully set user environmental variables. setting the dynamic link library. successfully set the dynamic link library. setting core file successfully set core path. setting pssh path successfully set pssh path. setting cgroup. successfully set cgroup. set arm optimization. no need to set arm optimization. fixing server package owner. setting finish flag. successfully set finish flag. preinstallation succeeded. -- 如果初始化过程中有warning或者abnormal,初始化输出结果中会提示执行 /opt/software/opengauss/script/gs_checkos -i a -h xsky-node1,xsky-node2,xsky-node3,xsky-node4 --detail 来检查初始化过程中warning或者abnormal详细信息,按照信息提示进行修改。 -- 可进入/var/log/omm目录下查看相关初始化日志信息

4.2 执行安装

# omm用户执行【主节点】 -- 切换至omm用户 [root@xsky-node1 ~]# su - omm -- 执行安装 [omm@xsky-node1 ~]$ gs_install -x /opt/software/opengauss/cluster_config.xml --gsinit-parameter="--locale=en_us.utf8" -- 上述命令执行输出结果如下 parsing the configuration file. check preinstall on every node. successfully checked preinstall on every node. creating the backup directory. successfully created the backup directory. begin deploy.. installing the cluster. begin prepare install cluster.. checking the installation environment on all nodes. begin install cluster.. installing applications on all nodes. successfully installed app. begin init instance.. encrypt cipher and rand files for database. please enter password for database: -- 设置数据库密码 please repeat for database: -- 重复输入相同密码 begin to create ca cert files the sslcert will be generated in /opt/gaussdb/install/app/share/sslcert/om create ca files for cm beginning. create ca files on directory [/opt/gaussdb/install/app_a07d57c3/share/sslcert/cm]. file list: ['cacert.pem', 'server.key', 'server.crt', 'client.key', 'client.crt', 'server.key.cipher', 'server.key.rand', 'client.key.cipher', 'client.key.rand'] non-dss_ssl_enable, no need to create ca for dss cluster installation is completed. configuring. deleting instances from all nodes. successfully deleted instances from all nodes. checking node configuration on all nodes. initializing instances on all nodes. updating instance configuration on all nodes. check consistence of memcheck and corescheck on database nodes. successful check consistence of memcheck and corescheck on all nodes. configuring pg_hba on all nodes. configuration is completed. starting cluster. ====================================================================== successfully started primary instance. wait for standby instance. ====================================================================== . successfully started cluster. ====================================================================== cluster_state : normal redistributing : no node_count : 4 datanode state primary : 1 standby : 2 secondary : 0 cascade_standby : 1 building : 0 abnormal : 0 down : 0 successfully installed application. end deploy.. -- 数据库密码设置要符合以下要求 1) 最少包含8个字符,最多包含16个字符。 2) 不能和用户名、当前密码(alter)、或当前密码反序相同。 3) 至少包含大写字母(a-z)、小写字母(a-z)、数字、非字母数字字符(限定为~!@#$%^&*()-_= \|[{}];:,<.>/?)四类字符中的三类字符 -- 数据库安装执行过程可进入/var/log/omm/omm/om目录查看gs_install和gs_local两个日志文件

4.3 数据库目录及含义

数据库安装完毕后,会生成如下相关目录,各目录及其含义如下:

项目目录说明 目录名称 子目录名称 描述说明
opengauss安装目录 /opt/gaussdb/install/app bin 存放数据库二进制文件目录
etc cgroup工具配置文件
include 存放数据库运行所需要头文件
lib 存放数据库库文件目录
share 存放数据库运行所需要公共文件(如配置文件模板)
opengauss数据目录 /opt/gaussdb/install/data/dn / dbnode实例数据目录
opengauss日志目录 /var/log/omm/omm bin 二进制程序的日志目录
gs_profile 数据库内核性能日志目录
om om日志目录
pg_audit 数据库审计日志目录
pg_log 数据库节点实例运行日志目录
opengauss系统工具目录 /opt/gaussdb/install/om script opengauss用户管理脚本文件目录
lib bin目录下二进制文件依赖库文件目录
opengauss临时文件目录 /opt/gaussdb/tmp 存放临时文件目录

4.4 安装验证

4.4.1 检查数据库集群状态

# omm用户执行【任意节点】 [root@xsky-nodexxx ~]# su - omm [omm@xsky-nodexxx ~]$ gs_om -t status --detail [ cmserver state ] node node_ip instance state ------------------------------------------------------------------------------ 1 xsky-node1 10.110.7.39 1 /opt/gaussdb/install/cm/cm_server primary 2 xsky-node2 10.110.7.40 2 /opt/gaussdb/install/cm/cm_server standby 3 xsky-node3 10.110.7.41 3 /opt/huawei/data/cmserver/cm_server standby 4 xsky-node4 10.110.7.42 4 /opt/huawei/install/cm/cm_server standby [ cluster state ] cluster_state : normal redistributing : no balanced : yes current_az : az_all [ datanode state ] node node_ip instance state --------------------------------------------------------------------------------- 1 xsky-node1 10.110.7.39 6001 /opt/gaussdb/install/data/dn p primary normal 2 xsky-node2 10.110.7.40 6002 /opt/gaussdb/install/data/dn s standby normal 3 xsky-node3 10.110.7.41 6003 /opt/gaussdb/install/data/dn s standby normal 4 xsky-node4 10.110.7.42 6004 /opt/gaussdb/install/data/dn c cascade standby normal -- state状态显示为normal表示数据库可正常使用

image20230716153422865.png

-- 也可以使用cm_ctl命令如下方式查看集群状态 [omm@xsky-nodexxx ~]$ cm_ctl query -cv [ cmserver state ] node instance state ------------------------------ 1 xsky-node1 1 primary 2 xsky-node2 2 standby 3 xsky-node3 3 standby 4 xsky-node4 4 standby [ cluster state ] cluster_state : normal redistributing : no balanced : yes current_az : az_all [ datanode state ] node instance state | node instance state | node instance state | node instance state ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 1 xsky-node1 6001 p primary normal | 2 xsky-node2 6002 s standby normal | 3 xsky-node3 6003 s standby normal | 4 xsky-node4 6004 c cascade standby normal

image20230716153505365.png

4.4.2 连接数据库测试

# omm用户执行【任意节点】 [root@xsky-nodexxx ~]# su - omm -- 26000为数据库主节点端口号,即xml配置文件中dataportbase值 [omm@xsky-node1 ~]$ gsql -d postgres -p 26000 gsql ((opengauss 5.0.0 build a07d57c3) compiled at 2023-03-29 03:07:56 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 | utf8 | en_us.utf8 | en_us.utf8 | template0 | omm | utf8 | en_us.utf8 | en_us.utf8 | =c/omm | | | | | omm=ctc/omm template1 | omm | utf8 | en_us.utf8 | en_us.utf8 | =c/omm | | | | | omm=ctc/omm (3 rows) opengauss=#

image20230716153642888.png

4.3.3 创建数据库

# omm用户执行【任意节点】 [root@xsky-nodexxx ~]# su - omm [omm@xsky-node1 ~]$ gsql -d postgres -p 26000 gsql ((opengauss 5.0.0 build a07d57c3) compiled at 2023-03-29 03:07:56 commit 0 last mr ) non-ssl connection (ssl connection is recommended when requiring high-security) type "help" for help. -- 创建数据库gaussdb并使用utf8字符集 opengauss=# create database gaussdb with encoding 'utf8' template = template0; create database opengauss=# \l list of databases name | owner | encoding | collate | ctype | access privileges ----------- ------- ---------- ------------ ------------ ------------------- gaussdb | omm | utf8 | en_us.utf8 | en_us.utf8 | postgres | omm | utf8 | en_us.utf8 | en_us.utf8 | template0 | omm | utf8 | en_us.utf8 | en_us.utf8 | =c/omm | | | | | omm=ctc/omm template1 | omm | utf8 | en_us.utf8 | en_us.utf8 | =c/omm | | | | | omm=ctc/omm (4 rows) -- \q 命令可退出当前数据库 opengauss=# \q -- 测试连接gaussdb数据库 [omm@xsky-node1 ~]$ gsql -d gaussdb -p 26000 gsql ((opengauss 5.0.0 build a07d57c3) compiled at 2023-03-29 03:07:56 commit 0 last mr ) non-ssl connection (ssl connection is recommended when requiring high-security) type "help" for help. gaussdb=# \l list of databases name | owner | encoding | collate | ctype | access privileges ----------- ------- ---------- ------------ ------------ ------------------- gaussdb | omm | utf8 | en_us.utf8 | en_us.utf8 | postgres | omm | utf8 | en_us.utf8 | en_us.utf8 | template0 | omm | utf8 | en_us.utf8 | en_us.utf8 | =c/omm | | | | | omm=ctc/omm template1 | omm | utf8 | en_us.utf8 | en_us.utf8 | =c/omm | | | | | omm=ctc/omm (4 rows) gaussdb=#

5.1 failed to check hostname mapping

**问题描述:**数据库初始化安装时有时会遇到如下报错:

[root@xsky-node1 script]# ./gs_preinstall -u omm -g dbgrp -x /opt/software/opengauss/cluster_config.xml parsing the configuration file. successfully parsed the configuration file. installing the tools on the local node. successfully installed the tools on the local node. are you sure you want to create trust for root (yes/no)?yes please enter password for root password: successfully created ssh trust for the root permission user. setting host ip env successfully set host ip env. distributing package. begin to distribute package to tool path. successfully distribute package to tool path. begin to distribute package to package path. successfully distribute package to package path. successfully distributed package. are you sure you want to create the user[omm] and create trust for it (yes/no)? yes please enter password for cluster user. password: please enter password for cluster user again. password: generate cluster user password files successfully. successfully created [omm] user on all nodes. preparing ssh service. successfully prepared ssh service. installing the tools in the cluster. successfully installed the tools in the cluster. checking hostname mapping. [failure] xsky-node1: [gauss-51222] : failed to check hostname mapping. command: "pssh -s -h xsky-node3 hostname". error: usage: pssh [options] command [...] pssh: error: no such option: -s [failure] xsky-node2: [gauss-51222] : failed to check hostname mapping. command: "pssh -s -h xsky-node4 hostname". error: usage: pssh [options] command [...] pssh: error: no such option: -s [failure] xsky-node3: [gauss-51222] : failed to check hostname mapping. command: "pssh -s -h xsky-node1 hostname". error: usage: pssh [options] command [...] pssh: error: no such option: -s [failure] xsky-node4: [gauss-51222] : failed to check hostname mapping. command: "pssh -s -h xsky-node3 hostname". error: usage: pssh [options] command [...] pssh: error: no such option: -s

**问题原因:**如果在服务器上手工安装了pssh包,安装后的pssh是不提供 -s 参数选项的,如下所示
87000d95672b37f84b2b29957e99610.png

而在主节点执行了gs_preinstall后,会重新安装新的pssh,手工安装的pssh和执行初始化安装的pssh文件大小是不同的,版本不同,且数据库初始化安装的pssh提供 -s 参数,而手工安装的pssh是不提供 -s 参数的,由于主备环境pssh不一致,导致pssh校验主机名时报错。

**解决办法:**解决办法就是将其它备节点/usr/bin/pssh或/use/local/bin/pssh改名或删除,使用主节点初始化gs_preinstall默认提供的pssh文件,该操作无需人工干预。

5.2 libpython3.6m.so.1.0文件缺失

**问题描述:**执行数据库初始化或者执行python3命令时,会遇到如下报错:

[root@xsky-node1 script]# ./gs_preinstall -u omm -g dbgrp -x /opt/software/opengauss/cluster_config.xml --non-interactive parsing the configuration file. successfully parsed the configuration file. installing the tools on the local node. successfully installed the tools on the local node. setting host ip env successfully set host ip env. distributing package. begin to distribute package to tool path. successfully distribute package to tool path. begin to distribute package to package path. successfully distribute package to package path. [gauss-51400] : failed to execute the command: python3 '/opt/software/opengauss/script/local/preinstallutility.py' -t check_config -u omm -x /opt/software/opengauss/cluster_config.xml. result:{'xsky-node4': 'failure', 'xsky-node3': 'success', 'xsky-node2': 'success'}. error: [success] xsky-node2: [success] xsky-node3: [failure] xsky-node4: traceback (most recent call last): file "/opt/software/opengauss/script/local/../gspylib/common/common.py", line 64, in import psutil file "/opt/software/opengauss/script/gspylib/common/../../../lib/psutil/__init__.py", line 102, in from . import _pslinux as _psplatform file "/opt/software/opengauss/script/gspylib/common/../../../lib/psutil/_pslinux.py", line 26, in from . import _psutil_linux as cext importerror: libpython3.6m.so.1.0: cannot open shared object file: no such file or directory during handling of the above exception, another exception occurred: traceback (most recent call last): file "/opt/software/opengauss/script/local/preinstallutility.py", line 37, in from gspylib.common.parameterparsecheck import parameter file "/opt/software/opengauss/script/local/../gspylib/common/parameterparsecheck.py", line 27, in from gspylib.common.common import defaultvalue file "/opt/software/opengauss/script/local/../gspylib/common/common.py", line 98, in import psutil file "/opt/software/opengauss/script/gspylib/common/../../../lib/psutil/__init__.py", line 102, in from . import _pslinux as _psplatform file "/opt/software/opengauss/script/gspylib/common/../../../lib/psutil/_pslinux.py", line 26, in from . import _psutil_linux as cext importerror: libpython3.6m.so.1.0: cannot open shared object file: no such file or directory

**问题原因:**如果服务器上曾安装过不同python3版本数据库,由于环境设置或被修改,可能导致提示libpython3.6m.so.1.0文件缺失。

解决办法:使用root用户执行find / -name "libpython3.6m.so.1.0"查找文件所在位置,比如/usr/local/python3/lib/libpython3.6m.so.1.0,然后将此文件拷贝到/usr/lib64目录下即可。

5.3 vm.overcommit_memory设置问题

**问题描述:**在执行数据库初始化时遇到如下报abnormal问题:

[root@xsky-node1 ~]# /opt/software/opengauss/script/gs_checkos -i a -h xsky-node1,xsky-node2,xsky-node3,xsky-node4 --detail [root@xsky-node1 ~]# /opt/software/opengauss/script/gs_checkos -i a -h xsky-node1,xsky-node2,xsky-node3,xsky-node4 --detail checking items: a1. [ os version status ] : normal [xsky-node1] centos_7.9.2009_64bit [xsky-node2] centos_7.9.2009_64bit [xsky-node4] centos_7.9.2009_64bit [xsky-node3] centos_7.9.2009_64bit a2. [ kernel version status ] : normal the names about all kernel versions are same. the value is "3.10.0-1160.83.1.el7.x86_64". a3. [ unicode status ] : normal the values of all unicode are same. the value is "lang=en_us.utf-8". a4. [ time zone status ] : normal the informations about all timezones are same. the value is " 0800". a5. [ swap memory status ] : warning [xsky-node3] swapmemory 68719472640 totalmemory 67288281088 a6. [ system control parameters status ] : abnormal [xsky-node3] abnormal reason: variable 'vm.overcommit_memory' realvalue '2' expectedvalue '0'. check_sysctl_parameter failed. [xsky-node2] abnormal reason: variable 'vm.overcommit_memory' realvalue '2' expectedvalue '0'. check_sysctl_parameter failed. [xsky-node4] abnormal reason: variable 'vm.overcommit_memory' realvalue '2' expectedvalue '0'. check_sysctl_parameter failed.

**问题原因:**初始化安装时建议将vm.overcommit_memory修改为0,而当前值为2,原因是因为官方文档里提示设置vm.overcommit_ratio值时,需当vm.overcommit_memory=2时此参数生效,如果在/etc/sysctl.conf里设置了vm.overcommit_memory=2其实是和数据库初始化建议值存在矛盾。
image20230716170355383.png

官方文档对于vm.overcommit_memory的设置是存在前后矛盾的。

image20230716170655861.png

解决办法:不要手工在/etc/sysctl.conf里设置vm.overcommit_memory值,利用数据库初始化自动设置该值。

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

文章被以下合辑收录

评论

网站地图