前言

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 流分析服务(Steam Analytics) 报出 OutputDataConversionError 错误引起延迟及超时

    问题描述 Azure 流分析服务(Steam Analytics) 报出 OutputDataConversionError 错误引起延迟及超时. 查看详细错误: 问题解答 在错误消息中,有非常明确的 ...

  2. DataX 离线跨网场景的实施配置

    配置仅限于跨不同网情况,网络互通情况方案和配置会更简单一点 内网A:MySql数据转换成Csv { "job": { "setting": { "sp ...

  3. 2024-03-02:用go语言,一个句子是由一些单词与它们之间的单个空格组成, 且句子的开头和结尾没有多余空格, 比方说,“Hello World“ ,“HELLO“ ,“hello world h

    2024-03-02:用go语言,一个句子是由一些单词与它们之间的单个空格组成, 且句子的开头和结尾没有多余空格, 比方说,"Hello World" ,"HELLO&q ...

  4. nginx判断是否手机访问

    if ( $http_user_agent ~* "(Android|iPhone|Windows Phone|UC|Kindle|MicroMessenger |iPad)" ) ...

  5. window.open代理劫持

    window.open = new Proxy(window.open, { apply(target, ctx, args) { if (hasAuth(args[0])) { return tar ...

  6. centos 添加 公钥,root不用输入密码 ssh-keygen

    centos 添加 公钥,root不用输入密码 ssh-keygen -t rsa -C "yourEmail" 一通回车后,生成 C:\Users\Reciter/.ssh/id ...

  7. leetcode数据库sql之Rising Temperature

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

  8. Jmeter前言

    前言 为什么要撰写这样一个教程呢? 深入学习Jmeter 温故而知新.尽管我已经使用JMeter很长时间,但还有许多元件我并不十分了解,因此,编写教程的过程成为了我的学习过程,通过反复回顾和整理知识, ...

  9. iOS模拟器 Unable to boot the Simulator —— Ficow笔记

    本文首发于 Ficow Shen's Blog,原文地址: iOS模拟器 Unable to boot the Simulator -- Ficow笔记. 内容概览 前言 终结模拟器进程 命令行改权限 ...

  10. 一周内容分享(第 10 期):别让自己"墙"了自己

    这里记录过去一周,我看到的值得分享的东西. 一方面是整理记录一下自己一周的学习,另一方面也是期待自己有更多的输出,有更多的价值. 周刊开源(Github:wmyskxz/weekly),欢迎提交 is ...