openGauss3.1.0企业版HA环境部署测试
前言
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环境部署测试的更多相关文章
- Rancher Server部署方式及Rancher HA环境部署
类似Rancher这种的容器管理和编排工具,它可以很快地让每个组织获得高效的弹性集群管理能力.当前技术世界的发展形势就是让开发人员从繁琐的应用配置和管理中解放出来,使用容器镜像来处理复杂的程序运行依赖 ...
- 【J2EE】struts-2.3.16.3+apache-tomcat-8.0.9开发环境部署,“Hello World”的实现。
1.在官网下载Struts2的开发包 下载链接如下: http://120.203.229.30/5ff/2bc79/5ff16ae8698e1c321758a8f03a1bc0939892bc79/ ...
- Vue.2.0.5-生产环境部署
删除警告 为了减少文件大小,Vue 精简独立版本已经删除了所有警告,但是当你使用 Webpack 或 Browserify 等工具时,你需要一些额外的配置实现这点. Webpack 使用 Webpac ...
- MooseFS 3.0 集群环境部署过程
1 准备好6台虚拟机:(centos7) Master server: 192.168.242.135 Cgi server: 192.168.242.135 meta ...
- Hadoop 学习笔记 (九) hadoop2.2.0 生产环境部署 HDFS HA部署方法
step1:将安装包hadoop-2.2.0.tar.gz存放到某一个目录下,并解压 step2:修改解压后的目录中的文件夹/etc/hadoop下的xml配置文件(如果文件不存在,则自己创建) 包括 ...
- Centos 7.6 安装部署 openGauss 3.1.0 企业版一主两备集群
一.安装环境设置 1.1 硬件环境 名称 最低配置 建议配置 测试配置 服务器数量 3 略 略 硬盘 * 至少1GB用于安装openGauss的应用程序.* 每个主机需大约300MB用于元数据存储.* ...
- 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 ...
- redis cluster安装部署(测试环境)
redis 应用于web前端,做缓存和数据存取的速度是挺可观的,最近看了一些资料,手痒了,就弄了一个测试环境,两台方案,试用一下. ##Redis 集群部署## 一,方案调研: 参考博客: http: ...
- 记录使用gogs,drone搭建自动部署测试环境
使用gogs,drone,docker搭建自动部署测试环境 Gogs是一个使用go语言开发的自助git服务,支持所有平台 Docker是使用go开发的开源容器引擎 Drone是一个基于容器技术的持续集 ...
- CentOS7+ApacheServer2.4+MariaDB10.0+PHP7.0+禅道项目管理软件8.0环境部署
CentOS7+ApacheServer2.4+MariaDB10.0+PHP7.0+禅道项目管理软件8.0环境部署 by:授客 QQ:1033553122 目录 一. 二. 三. 四. 五. 六. ...
随机推荐
- 【Azure 环境】通过Python SDK收集所有订阅简略信息,例如订阅id 名称, 资源组及组内资源信息等,如何给Python应用赋予相应的权限才能获取到信息呢?
问题描述 通过Python SDK收集所有订阅简略信息,例如订阅id 名称, 资源组及组内资源信息等,如何给Python应用赋予相应的权限才能获取到信息呢?在一个企业的账号中,同一个组织有一个相同的 ...
- 使用秘籍|如何实现图数据库 NebulaGraph 的高效建模、快速导入、性能优化
本文整理自 NebulaGraph PD 方扬在「NebulaGraph x KubeBlocks」meetup 上的演讲,主要包括以下内容: NebulaGraph 3.x 发展历程 NebulaG ...
- Codeforces Round 734 (Div. 3)B2. Wonderful Coloring - 2(贪心构造实现)
思路: 分类讨论: 当一个数字出现的次数大于等于k,那么最多有k个能被染色, 当一个数字出现的次数小于k,南那么这些数字都可能被染色 还有一个条件就是需要满足每个颜色的数字个数一样多,这里记出现次数小 ...
- Sub-process /usr/bin/dpkg returned an error code (1)问题
在用apt-get安装软件包的时候遇到E: Sub-process /usr/bin/dpkg returned an error code (1)问题,解决方法如下: cd /var/lib/dpk ...
- python json实例解析
python和json python这个语言的流行程度不用我说了,估计大家都知道吧.在字符串处理领域,json真是神一样的存在.最近一个项目中用到了,才感觉到它的威力.感觉非常有必要做一个记录和总 ...
- 逆向通达信Level-2 续十一 (无帐号登陆itrend研究版)
<续九>无帐号打开了itrend研究版但是用不了.今次无帐号登陆itrend研究版可以使用行情. 演示三图 1. 首先成功在金融终端无帐号登陆成功. 2. 同理应用在itrend研究版,却 ...
- echo: nice day
乐开花了,echo 姑娘,很合我的胃口,活泼.俏皮.专业.三观出乎的齐,第一次遇见这种默契度如此高的,你说半句我懂,我说半句你懂,太完美了,以前感觉和女生沟通太累,聊几句就 game over,我这是 ...
- InfluxDB、Grafana、node_exporter、Prometheus搭建压测平台
InfluxDB.Grafana.node_exporter.Prometheus搭建压测平台 我们的压测平台的架构图如下: 配置docker环境 1)yum 包更新到最新 sudo yum upda ...
- 自定义Key类型的字典无法序列化的N种解决方案
当我们使用System.Text.Json.JsonSerializer对一个字典对象进行序列化的时候,默认情况下字典的Key不能是一个自定义的类型,本文介绍几种解决方案. 一.问题重现 二.自定义J ...
- uni组件传值注意
目录介绍 01.组件传值遇到坑 02.父组件传值给子组件 03.子组件传值给父组件 01.组件传值遇到坑 子组件给父组件传值注意点 注意子组件触发事件定义的方法,首先在父组件中需要绑定子组件内部对应事 ...