前言

openGauss 是华为开源的一款高性能关系型数据库,这两年感觉 pg 系的数据库在国内慢慢火起来了,pg 的操作还是跟 mysql 和 oracle 略有差距,还得慢慢学,先从部署开始吧。对于我这种老鸟,本以为对着手册部署还不得一把过啊,没想到其中还是碰到了不少问题,折腾了多半天终于搞定了。

环境

信息 主机 1 主机 2

主机名 opengauss01 opengauss02

IP 地址 ... ...

os 版本 centos 7.9 centos 7.9

部署 openGauss

1、修改/etc/hosts

[root@opengauss01 /]# cat /etc/hosts

... localhost localhost.localdomain localhost4 localhost4.localdomain4

::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

... opengauss01

... opengauss02

2、关闭防火墙

[root@opengauss01 /]# systemctl stop firewalld

[root@opengauss01 /]# systemctl disable firewalld

======》这两步一定要做哈,尤其是后面那个 disable,我在做的时候就忘了,后边重启了 os,防火墙又启动了,导致备库始终连不上主库的端口。

3、关闭 selinux

[root@opengauss01 /]# setenforce 0

[root@opengauss01 /]# cat /etc/selinux/config

SELINUX=disabled

SELINUXTYPE=targeted

4、 修改系统资源限制参数

[root@opengauss01 /]# echo "* soft stack 3072" >> /etc/security/limits.conf

[root@opengauss01 /]# echo "* hard stack 3072" >> /etc/security/limits.conf

[root@opengauss01 /]# echo "* soft nofile 1000000" >> /etc/security/limits.conf

[root@opengauss01 /]# echo "* hard nofile 1000000" >> /etc/security/limits.conf

[root@opengauss01 /]# echo "* soft nproc unlimited" >> /etc/security/limits.d/90-nproc.conf

5、关闭透明大页

[root@opengauss01 /]# echo never > /sys/kernel/mm/transparent_hugepage/enabled

[root@opengauss01 /]# echo never > /sys/kernel/mm/transparent_hugepage/defrag

======》这个是在线关闭,也可以从内核层面关闭。

6、下载企业版安装包,部署 HA 的话,就需要企业版的。

地址:https://opengauss.org/zh/download/

7、上传压缩包并解压

[root@opengauss02 opengauss]# tar -xvf openGauss-Lite-3.1.0-CentOS-x86_64.tar.gz

./dependency/

./dependency/libstdc++.so.6

./install.sh

./openGauss-Lite-3.1.0-CentOS-x86_64.bin

./openGauss-Lite-3.1.0-CentOS-x86_64.sha256

./opengauss_lite.conf

./uninstall.sh

./upgrade_common.sh

./upgrade_config.sh

./upgrade_errorcode.sh

./upgrade_GAUSSV5.sh

./upgrade_sql.sha256

./upgrade_sql.tar.gz

./version.cfg

8、安装依赖包 expect

yum install expect -y

======》这个在安装的时候需要。

9、安装 python3 环境

参考https://www.cnblogs.com/lemon-feng/p/11208435.html

./configure --prefix=/usr/local/python3 --enable-shared CFLAGS=-fPIC

======》注意安装 python3.6,我是 CentOS,不同的操作系统 python 版本也不一样。具体可以看下图,另外如果 configure 的时候不加--enable-shared CFLAGS=-fPIC,安装

openGauss 的时候会报错。

10、修改安装的配置文件

[root@opengauss01 conf]# cp cluster_config_template.xml cluster_config.xml

[root@opengauss02 opengauss]# cat cluster_config.xml

######节点主机名######

######数据库安装目录,保证这个目录是空的######

######数据库日志目录,无需新建,安装的时候自动建######

######数据库临时目录,无需新建,安装的时候自动建######

######数据库工具目录,无需新建,安装的时候自动建######

######数据库corefile目录,无需新建,安装的时候自动建######

######节点IP,与数据库节点名称列表一一对应######

######节点1的主机名称 ######

######节点1的IP,如果服务器只有一个网卡可用,将backIP1和sshIP1配置成同一个IP ######

######两个节点的数据目录######

<DEVICE sn="opengauss02">
######节点2的主机名称 ######
<PARAM name="name" value="opengauss02"/>
<PARAM name="azName" value="AZ1"/>
<PARAM name="azPriority" value="1"/>
<PARAM name="backIp1" value="***.***.***.***"/>
<PARAM name="sshIp1" value="***.***.***.***"/>
</DEVICE>

11、创建用户和组
[root@opengauss02 opengauss]# groupadd dbgrp

[root@opengauss02 opengauss]# useradd omm -G dbgrp

[root@opengauss02 opengauss]# passwd omm

12、修改目录属组和权限

[root@opengauss01 bin]# chmod 755 -R /opengauss

[root@opengauss01 bin]# chown omm:dbgrp -R /opengauss

13、执行预检查

[root@opengauss01 /]# ./gs_preinstall -U omm -G dbgrp -X /opengauss_soft/cluster_config.xml

======》我在执行预检查的时候,碰到两次奇怪的问题:

A、 如果在预检查阶段有以下报错:

[FAILURE] opengauss01:

[GAUSS-50305] : The user is not matched with the user group.

[FAILURE] opengauss02:

[GAUSS-50305] : The user is not matched with the user group.

解决方案: 删除新建的 omm 用户,脚本会自动建 omm 用户,这一步挺奇怪,如果不执行第 11 步的创建 omm 用户,在执行预检查的时候又会报安装目录的属组不对。

B、 如果预检查阶段有以下报错:

[FAILURE] opengauss01:

[GAUSS-50200] : The /opengauss already exists. Please remove it. It should be a symbolic link to $GAUSSHOME if it exists

[FAILURE] opengauss02:

[GAUSS-50200] : The /opengauss already exists. Please remove it. It should be a symbolic link to $GAUSSHOME if it exists

解决方案:xml 中程序安装目录不能和其他目录在同一个层次下。这就是第 10 步中的 gaussdbAppPath 不要配置跟其他目录在同一个目录层中。

14、 查看检查的情况

[root@opengauss01 /]# /opengauss_soft/script/gs_checkos -i A -h opengauss01,opengauss02 –detail

15、执行安装脚本

[omm@opengauss01 script]$ ./gs_install -X /opengauss_soft/cluster_config.xml --gsinit-parameter="--encoding=UTF8"

注意需要 omm 用户执行,另外 database 密码需要至少大小写、数字、特殊字符中的三个。

16、查看集群状态

[omm@opengauss01 script]$ gs_om -t status --detail

[ Cluster State ]

cluster_state : Normal

redistributing : No

current_az : AZ_ALL

[ Datanode State ]

node       node_ip         port      instance                   state

1 opengauss01 ... 15400 6001 /opengauss/data/dn P Primary Normal

2 opengauss02 ... 15400 6002 /opengauss/data/dn S Standby Normal

======》节点 1 是 Primary Normal,节点 2 是 Standby Normal,这种状态是正确的。

======》如果有问题可以尝试卸载了重装

[omm@opengauss01 ~]$ gs_uninstall --delete-data

Checking uninstallation.

Successfully checked uninstallation.

Stopping the cluster.

Successfully stopped the cluster.

Successfully deleted instances.

Uninstalling application.

Successfully uninstalled application.

Uninstallation succeeded.

切换测试

1、执行 switchover

[omm@opengauss02 ~]$ gs_ctl switchover -D /opengauss/data/dn/

[2022-11-09 18:52:39.086][59376][][gs_ctl]: gs_ctl switchover ,datadir is /opengauss/data/dn

[2022-11-09 18:52:39.086][59376][][gs_ctl]: switchover term (1)

[2022-11-09 18:52:39.096][59376][][gs_ctl]: waiting for server to switchover........

[2022-11-09 18:52:44.180][59376][][gs_ctl]: done

[2022-11-09 18:52:44.180][59376][][gs_ctl]: switchover completed (/opengauss/data/dn)

======》这个命令要在当前的备库执行,不然没啥效果

2、确认主备状态

[omm@opengauss02 ~]$ gs_om -t status --detail

[ Cluster State ]

cluster_state : Normal

redistributing : No

current_az : AZ_ALL

[ Datanode State ]

node       node_ip         port      instance                   state

1 opengauss01 ... 15400 6001 /opengauss/data/dn P Standby Normal

2 opengauss02 ... 15400 6002 /opengauss/data/dn S Primary Normal

3、保存主备信息

[omm@opengauss02 ~]$ gs_om -t refreshconf

Generating dynamic configuration file for all nodes.

Successfully generated dynamic configuration file.

openGauss3.1.0企业版HA环境部署测试的更多相关文章

  1. Rancher Server部署方式及Rancher HA环境部署

    类似Rancher这种的容器管理和编排工具,它可以很快地让每个组织获得高效的弹性集群管理能力.当前技术世界的发展形势就是让开发人员从繁琐的应用配置和管理中解放出来,使用容器镜像来处理复杂的程序运行依赖 ...

  2. 【J2EE】struts-2.3.16.3+apache-tomcat-8.0.9开发环境部署,“Hello World”的实现。

    1.在官网下载Struts2的开发包 下载链接如下: http://120.203.229.30/5ff/2bc79/5ff16ae8698e1c321758a8f03a1bc0939892bc79/ ...

  3. Vue.2.0.5-生产环境部署

    删除警告 为了减少文件大小,Vue 精简独立版本已经删除了所有警告,但是当你使用 Webpack 或 Browserify 等工具时,你需要一些额外的配置实现这点. Webpack 使用 Webpac ...

  4. MooseFS 3.0 集群环境部署过程

    1 准备好6台虚拟机:(centos7) Master server:  192.168.242.135 Cgi server:                192.168.242.135 meta ...

  5. Hadoop 学习笔记 (九) hadoop2.2.0 生产环境部署 HDFS HA部署方法

    step1:将安装包hadoop-2.2.0.tar.gz存放到某一个目录下,并解压 step2:修改解压后的目录中的文件夹/etc/hadoop下的xml配置文件(如果文件不存在,则自己创建) 包括 ...

  6. Centos 7.6 安装部署 openGauss 3.1.0 企业版一主两备集群

    一.安装环境设置 1.1 硬件环境 名称 最低配置 建议配置 测试配置 服务器数量 3 略 略 硬盘 * 至少1GB用于安装openGauss的应用程序.* 每个主机需大约300MB用于元数据存储.* ...

  7. ubuntu12.04+hadoop2.2.0+zookeeper3.4.5+hbase0.96.2+hive0.13.1伪分布式环境部署

    目录: 一.hadoop2.2.0.zookeeper3.4.5.hbase0.96.2.hive0.13.1都是什么? 二.这些软件在哪里下载? 三.如何安装 1.安装JDK 2.用parallel ...

  8. redis cluster安装部署(测试环境)

    redis 应用于web前端,做缓存和数据存取的速度是挺可观的,最近看了一些资料,手痒了,就弄了一个测试环境,两台方案,试用一下. ##Redis 集群部署## 一,方案调研: 参考博客: http: ...

  9. 记录使用gogs,drone搭建自动部署测试环境

    使用gogs,drone,docker搭建自动部署测试环境 Gogs是一个使用go语言开发的自助git服务,支持所有平台 Docker是使用go开发的开源容器引擎 Drone是一个基于容器技术的持续集 ...

  10. CentOS7+ApacheServer2.4+MariaDB10.0+PHP7.0+禅道项目管理软件8.0环境部署

    CentOS7+ApacheServer2.4+MariaDB10.0+PHP7.0+禅道项目管理软件8.0环境部署 by:授客 QQ:1033553122 目录 一. 二. 三. 四. 五. 六. ...

随机推荐

  1. 【Azure 环境】当Azure Key Vault中存储的证书即将过期时,如何设置Alert邮件警报?

    问题描述 当Azure Key Vault 中存储的证书即将过期时, 如何设置Alert邮件警报? 问题解答 首先,在创建完一个证书后,需要为证书添加一个"证书联系人" 然后,点击 ...

  2. Kotlin扩展函数与属性原理解析

    一.扩展函数 扩展函数可以方便地给现有类增加属性和方法而不改动类地代码. 二.原理 fun String.addTo(s: String): String{ return this + s } 反编译 ...

  3. PbRL | Preference Transformer:反正感觉 transformer 很强大

    论文题目:Preference Transformer: Modeling Human Preferences using Transformers for RL,ICLR 2023,5 6 6 8, ...

  4. 使用PdfSharp从模板生成Pdf文件

    ​ 最近在做一个生成文档的需求.通过先制作一个包含各字段占位符的文档模板,导入这个模板并填写内容替换掉占位符,再输出成最终文件. 由于版式固定,安全性更好,业务上常用Pdf作为最终标准化的格式, 在. ...

  5. tp5.1 controller 名称自动转换大小写,导致文件名对不上 url_convert

    // 是否自动转换URL中的控制器和操作名 'url_convert' => false, // true,

  6. Docker 安装成功(win10家庭版)

    https://desktop.docker.com/win/stable/Docker Desktop Installer.exe 安装遇到了 然后 更新 这个 https://wslstorest ...

  7. 记录--a标签跳转新地址无法访问,但手动输入新地址可以访问

    这里给大家分享我在网上总结出来的一些知识,希望对大家有所帮助 问题描述 最近遇到一个有意思的问题,项目中有一个地方,点击需要跳转到一个新的域名地址 笔者使用a标签做跳转,跳是跳过去了,可是跳过去以后, ...

  8. 记录--JavaScript 用简约的代码实现一些日常功能

    这里给大家分享我在网上总结出来的一些JavaScript 知识,希望对大家有所帮助 一.日期处理 1. 检查日期是否有效 该方法用于检测给出的日期是否有效: const isDateValid = ( ...

  9. 技嘉主板开启VT

    AM4接口主板开启虚拟化: M.I.T.->Advanced Frequency Settings->Advanced CPU Core Settings->SVM Mode (虚拟 ...

  10. TCL基本语法2

    TCL基本语法2 1.format和scan 两个基本的函数,和C语言中的sprintf和scanf的作用基本相同.format将不同类型的数据压缩在字符串中,scan将字符串中的数据提取出来. se ...