前言

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 应用服务】由Web App“无法连接数据库”而逐步分析到解析内网地址的办法(SQL和Redis开启private endpoint,只能通过内网访问,无法从公网访问的情况下)

    问题描述 在Azure上创建的数据库,单独通过SQL的连接工具是可以访问,但在Web App却无法访问,错误信息为: { "timestamp": "2021-05-20 ...

  2. C++字符串编码转换

    C++中字符串有很多种类,详情参考C++中的字符串类型.本文主要以string类型为例,讲一下字符串的编码,选择string主要是因为: byte是字符串二进制编码的最小结构,字符串本质上就是一个by ...

  3. 2023中山市第三届香山杯网络安全大赛初赛wp

    序 被带飞了 PWN move 先往变量 sskd 写入 0x20 字节,往第二个输入点输入 0x12345678 即可进入到第三个输入点,存在 0x8 字节的溢出.思路是在第一个输入点布置 rop ...

  4. 安装VMware——Unable to install all modules.See log /tmp/vmware-han/vmware-6098.log for detalls.(Exit code 1)的解决方法(模块加载失败)

    这是编译失败的原因在VM社区有这样一种解决方案,亲测有效,帮助我自己解决的麻烦,所有在这分享,希望能够帮助到小伙伴:不要被接下来的代码吓倒因为这是github上项目,所以要先在ubuntu上安装git ...

  5. 音频wav文件转sbc工具wav2sbc下载

    前记: 书到用时方恨少,工具用时方才发现好不到.为了一个工具,也是折腾了有一阵了. 工具说明: 在耳机中,各大芯片公司为了节省内存,本地播放的一般都是sbc格式文件,这就用到了wav转sbc文件的软件 ...

  6. leetcode数据库sql之Rising Temperature

    leetcode原文引用: Given a Weather table, write a SQL query to find all dates' Ids with higher temperatur ...

  7. 3DCAT首届行业生态交流会|爱智慧科技有限公司CEO梁新刚:工业元宇宙的”形“与”神“

    2021年12月17日下午,由深圳市瑞云科技有限公司主办,深圳市虚拟现实产业联合会协办的 云XR如何赋能元宇宙--3DCAT实时云渲染首届行业生态合作交流会 圆满落幕.此次活动围绕"云XR如 ...

  8. 记录--css水滴登录界面

    这里给大家分享我在网上总结出来的一些知识,希望对大家有所帮助 前言 今天我们来分享一款非常有趣的登录界面,它使用HTML和CSS制作,具有动态的水波纹效果,让用户在登录时感受到了一股清凉之感. 基本h ...

  9. HDFS Balancer负载均衡器

    目录 1.背景 2.什么是平衡 2.1 每个DataNode的利用率计算 2.2 集群的利用率 2.3 平衡 3.hdfs balancer语法 4.运行一个简单的balance案例 4.1 设置平衡 ...

  10. 一文搞懂JavaEE的接口

    在Java EE(Java Enterprise Edition)开发环境中,编程意义上的"接口"(interface)和API接口虽然都涉及接口的概念,但它们属于不同层面的术语. ...