前言

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 App Service】误删除App Service资源,怎么办?

    问题描述 操作不当,误删除了App Service的资源,怎么办? 问题解答 根据Azure 官方文档,可以使用 Powershell 命令恢复到原始 App Service 应用名称. 操作步骤 第 ...

  2. C#多线程(7):手动线程通知

    目录 区别与示例 ManualResetEvent 类 ManualResetEventSlim 区别与示例 AutoResetEvent 和 ManualResetEvent 十分相似.两者之间的区 ...

  3. Android的BLE广播数据包解析---Android系列, 蓝牙技术(含BLE)

    一.引言 理解和分析这个数据包结构(这里面也涉及广播间隔时间的设置,设备广播数据间隔设置长了,会影响设备被发现的效率:设置短时,又响应功耗). 我们所说的BLE设备,其实是有区分有两种角色 Centr ...

  4. C++ //谓词 //一元谓词 //概念:返回bool类型的仿函数称为 谓词 //如果 operator()接受一个参数,那么叫做一元谓词 //如果 operator()接受 2 个参数,那么叫做一元谓词

    1 //谓词 2 //一元谓词 3 //概念:返回bool类型的仿函数称为 谓词 4 //如果 operator()接受一个参数,那么叫做一元谓词 5 //如果 operator()接受 2 个参数, ...

  5. springboot参数据校验

    什么是Hibernate Validator? Hibernate Validator是Hibernate提供的一个开源框架,使用注解方式非常方便的实现服务端的数据校验. 官网:http://hibe ...

  6. 尚硅谷Java 宋红康2023版 - 学习笔记

    尚硅谷Java 宋红康2023版 - 学习笔记 观看地址 https://www.bilibili.com/video/BV1PY411e7J6 60-IDEA开发工具-HelloWorld的编写与相 ...

  7. PowerShell alias - cmd中设置别名 快捷的执行命令

    Step. 1: 发现需求 最近学nest.js发现,都是用命令创建工程文件,然后教程里面都是用的快捷命令 比如 pd = pnpm run dev pb = pnpm run build 但是我这里 ...

  8. 静态类使用@Resource注解注入

    工作中需要,简单记录一下 @Component public class AccountUtil { private static AccountIdDao accountIdDao; @Resour ...

  9. 数据库表到java类转换工具

    //该工具类可以实现:给定一个指定的数据库表名,即可自动生成对应的java实体类 package com.iamzken.utils; import java.io.BufferedWriter; i ...

  10. 怎么实现Redis的高可用?(主从、哨兵、集群)

    高可用有两个含义:一是数据尽量不丢失,二是保证服务尽可能可用. AOF 和 RDB 数据持久化保证了数据尽量不丢失,那么多节点来保证服务尽可能提供服务. 一般在实际生产中,服务不会部署成单节点,主要是 ...