【参赛作品20】从零开始,快速认识实践使用openGauss

【参赛作品20】从零开始,快速认识实践使用openGauss,第1张

【参赛作品20】从零开始,快速认识实践使用openGauss

本文旨在基于理论和实践快速认识opengauss,基于openGauss 2.01 搭建1主+1备+1级联备测试环境,一共有三个机器构成。

认识篇 2.0.1版新增特性:
  • 支持延迟备库
  • 相对主机,备机可以延迟一段指定的时间后再回放XLOG记录
  • 备机支持逻辑复制
  • 支持备机逻辑解码,可以减少主机的压力
  • 扩容工具功能增强
  • 优化了扩容工具,支持不停服在线扩容备机或级联备
  • 灰度升级
  • 优化升级工具,增加灰度升级能力,支持业务在线升级。目前仅支持从1.1.0版本到2.0.0版本进行灰度升级
  • 备机IO写放大优化
  • 优化备机IO,平滑备机检查点刷盘的IO量,解决备机IO量大影响查询性能问
  • WDR诊断报告增加数据库运行指标
  • 新增“Effective CPU”、“WalWrite NoWait”、“Soft Parse”、“Non-Parse” CPU四个数据库运行指标
  • Data Studio客户端工具特性
  • 增加pldebugger调试功能
  • 增加pldebugger调试功能的回滚,在使用Data Studio调试前增加选项来保证调试函数在修改完数据后回退支持xml和serial类型,表中增加列,列的类型支持xml和serial(big|normal|small)类型支持在Data Studio中创建和展示外表对象支持列存表的partial_cluster_key约束全局临时表支持DDL的展示和导出创建分区表支持LOCAL和GLOBAL标记增加MOT表的展示
2.1.0版新增特性:
  • openGauss 2.1.0于2021年9月30日发布,是openGauss的一个Preview版本,该版本生命周期仅为半年。该版本的新增功能如下:
  • 存储过程兼容性增强
  • SQL引擎能力增强
  • 支持Ustore存储引擎
  • 支持段页式存储
  • 基于Paxos分布式一致性协议的高可用
  • AI4DB和DB4AI竞争力持续构筑
  • 日志框架及错误码整改
  • JDBC客户端负载均衡及读写分离
  • 支持cmake脚本编译
  • 列存表支持主键唯一键约束
  • 支持jsonb数据类型
  • 支持unique sql自动淘汰
  • UCE故障感知
  • 支持GB18030字符集
  • 备机catch优化
  • 客户端工具gsql支持readline命令自动补齐
  • 动态数据脱敏• 支持国密算法
  • 防篡改账本数据库
  • 内置角色和权限管理机制
  • 透明加密
  • 全密态数据库增强
  • 支持dblink
  • 支持Ubuntu系统
  • 支持Hash索引
  • upsert支持子查询
  • min/max函数支持ip地址类型
  • 增加array_remove/array_replace/first/last函数
  • Data Studio客户端工具适配内核特性

https://opengauss.org/zh/download.html

openGauss是什么

摘自百度,openGauss是一款开源关系型数据库管理系统 ,采用木兰宽松许可证v2发行 。openGauss内核源自PostgreSQL,深度融合华为在数据库领域多年的经验,结合企业级场景需求,持续构建竞争力特性。同时openGauss也是一个开源、免费的数据库平台,鼓励社区贡献、合作。2019年9月19日在华为全联接大会上,华为宣布将开源其数据库产品,开源后命名为openGauss 。2020 年 6 月30日openGauss 数据库源代码正式开放。目前openGauss版本规划按照6个月一个小版本,1年一个大版本的节奏,版本生命周期暂定3年。

众所周知,华为少数不多数字化转型成功的企业,数据库作为其中其中的利器,华为研究数据库技术及产品,可以追溯到2001年。为了 支持电信产品和诸多内部运营管理系统,华为根据业务场景研发了GMDB内存库、GaussDB 100 OLTP数据库、GaussDB 200 OLAP数据库,GaussDB云数据库、多模数据库,统称GaussDB。 openGauss与GaussDB同样的内核,但是架构上不同,openGauss表现为单体式数据库,而GaussDB更多表现分布式数据库,采用数据分片管理。自2020年6月30日开源,openGauss走入千百个人开发者的视线,与大量的中小企业和上市企业结盟连线,而且长期保持在排行傍前5名。

为什么选择openGauss

理由一,事实说话,用客户的选择说话。见2020年数据库市场排名,SQL Server和Oracle排第一、第二,阿里第七、华为第十。

理由二,就像为什么买苹果,因为乔布斯。为什么选择Gauss,因为华为,华为是质量的代名词,也是中国人的骄傲。
理由三,openGauss开源免费可用,如果遇上性能问题或者需要商业技术支持,可以轻轻松松接入云GaussDB。

实践篇

** *** 作系统版本:**CentOS7

硬件配置: 8c/64G/100GB

节点信息:

[主节点] 192.168.30.22 prod

[备节点] 192.168.30.21 stb1

[级联备] 192.168.30.20 casstb

[root@hybriddb03 opengauss]# cd /opt/software/opengauss/
[root@hybriddb03 opengauss]# wget https://opengauss.obs.cn-south-1.myhuaweicloud.com/2.1.0/x86/openGauss-2.1.0-CentOS-64bit-all.tar.gz
[root@hybriddb03 opengauss]# cd /opt/software/opengauss/
[root@hybriddb03 opengauss]# tar zxvf openGauss-2.1.0-CentOS-64bit-all.tar.gz
目录下再解压openGauss-2.1.0-CentOS-64bit-om.tar.gz

[root@hybriddb03 opengauss]#tar zxvf openGauss-2.1.0-CentOS-64bit-om.tar.gz

建立一个配置文件 cluster_config.xml

在opengauss的目录下建一个文件cluster_config.xml,包含以下内容

 
  
 
 
 
 
 
 
 
 

<DEVICELIST>
    <DEVICE sn="prod">
        <PARAM name="name" value="hybriddb03"/>
        <PARAM name="azName" value="AZ1"/>
        <PARAM name="azPriority" value="1"/>
        <PARAM name="backIp1" value="192.168.30.22"/>
        <PARAM name="sshIp1" value="192.168.30.22"/>
        <!--dn-->
        <PARAM name="dataNum" value="1"/>
        <PARAM name="dataPortbase" value="36000"/>
        <PARAM name="dataNode1" value="/data/opengauss/cluster/db1,hybriddb02,/data/opengauss/cluster/db1,

hybriddb01,/data/opengauss/cluster/db1"/>


















以root身份执行cluster_config.xml

[root@hybriddb03 opengauss]# ./script/gs_preinstall -U omm -G dbgrp -X ./cluster_config.xml
Parsing the configuration file.
Successfully parsed the configuration file.
Installing the tools on the local node.
Successfully installed the tools on the local node.
Are you sure you want to create trust for root (yes/no)? no
Setting pssh path
Successfully set core path.
Distributing package.
Begin to distribute package to tool path.
Successfully distribute package to tool path.
Begin to distribute package to package path.
Successfully distribute package to package path.
Successfully distributed package.
Are you sure you want to create the user[omm] and create trust for it (yes/no)? yes
Please enter password for cluster user.
Password:
Please enter password for cluster user again.
Password:
Successfully created [omm] user on all nodes.
Preparing SSH service.
Successfully prepared SSH service.
Installing the tools in the cluster.
Successfully installed the tools in the cluster.
Checking hostname mapping.
Successfully checked hostname mapping.
Creating SSH trust for [omm] user.
Checking network information.
All nodes in the network are Normal.
Successfully checked network information.
Creating SSH trust.
Creating the local key file.
Successfully created the local key files.
Appending local ID to authorized_keys.
Successfully appended local ID to authorized_keys.
Updating the known_hosts file.
Successfully updated the known_hosts file.
Appending authorized_key on the remote node.
Successfully appended authorized_key on all remote node.
Checking common authentication file content.
Successfully checked common authentication content.
Distributing SSH trust file to all node.
Successfully distributed SSH trust file to all node.
Verifying SSH trust on all hosts.
Successfully verified SSH trust on all hosts.
Successfully created SSH trust.
Successfully created SSH trust for [omm] user.
Checking OS software.
Successfully check os software.
Checking OS version.
Successfully checked OS version.
Creating cluster’s path.
Successfully created cluster’s path.
Setting SCTP service.
Successfully set SCTP service.
Set and check OS parameter.
Setting OS parameters.
Successfully set OS parameters.
Warning: Installation environment contains some warning messages.
Please get more details by “/soft/script/gs_checkos -i A -h minion1,minion2,minion3 --detail”.
Set and check OS parameter completed.
Preparing CRON service.
Successfully prepared CRON service.
Setting user environmental variables.
Successfully set user environmental variables.
Setting the dynamic link library.
Successfully set the dynamic link library.
Setting Core file
Successfully set core path.
Setting pssh path
Successfully set pssh path.
Set ARM Optimization.
No need to set ARM Optimization.
Fixing server package owner.
Setting finish flag.
Successfully set finish flag.
Preinstallation succeeded.

[root@hybriddb03 opengauss]# ./script/gs_checkos -i A -h hybriddb03,hybriddb02,hybriddb01 --detail
Checking items:
A1. [ OS version status ] : Normal
[hybriddb02]
centos_7.6_64bit
[hybriddb01]
centos_7.6.2003_64bit
[hybriddb03]
centos_7.6_64bit
A2. [ Kernel version status ] : Warning
[hybriddb01]
3.10.0-1127.el7.x86_64
[hybriddb03]
3.10.0-1160.el7.x86_64
A3. [ Unicode status ] : Normal
The values of all unicode are same. The value is “LANG=en_US.UTF-8”.
A4. [ Time zone status ] : Normal
The informations about all timezones are same. The value is “+0800”.
A5. [ Swap memory status ] : Normal
The value about swap memory is correct.
A6. [ System control parameters status ] : Warning
[hybriddb03]
Warning reason: variable ‘net.ipv4.tcp_retries1’ RealValue ‘3’ ExpectedValue ‘5’.
Warning reason: variable ‘net.ipv4.tcp_syn_retries’ RealValue ‘6’ ExpectedValue ‘5’.
Check_SysCtl_Parameter warning.
A7. [ File system configuration status ] : Normal
Both soft nofile and hard nofile are correct.
A8. [ Disk configuration status ] : Normal
The value about XFS mount parameters is correct.
A9. [ Pre-read block size status ] : Normal
The value about Logical block size is correct.
A10.[ IO scheduler status ] : Normal
The value of IO scheduler is correct.
A11.[ Network card configuration status ] : Warning
[hybriddb02]BondMode Null
Warning reason: network ‘enp96s0f0’ ‘mtu’ RealValue ‘1500’ ExpectedValue ‘8192’
[hybriddb03]
BondMode Null
Warning reason: network ‘eno1’ ‘mtu’ RealValue ‘1500’ ExpectedValue ‘8192’
[hybriddb01]
BondMode Null
Warning reason: network ‘eno1’ ‘mtu’ RealValue ‘1500’ ExpectedValue ‘8192’
A12.[ Time consistency status ] : Warning
[hybriddb01]
The NTPD not detected on machine and local time is “2021-11-29 15:25:46”.
[hybriddb02]
The NTPD not detected on machine and local time is “2021-11-29 15:25:46”.
[hybriddb03]
The NTPD not detected on machine and local time is “2021-11-29 15:25:46”.
A13.[ Firewall service status ] : Normal
The firewall service is stopped.
A14.[ THP service status ] : Normal
The THP service is stopped.
Total numbers:14. Abnormal numbers:0. Warning numbers:4.

warning级别的信息可以忽略不管。

实施安装

[omm@hybriddb03 opengauss]$ ./script/gs_install -X ./cluster_config.xml
Parsing the configuration file.
Check preinstall on every node.
Successfully checked preinstall on every node.
Creating the backup directory.
Successfully created the backup directory.
begin deploy…
Installing the cluster.
begin prepare Install Cluster…
Checking the installation environment on all nodes.
begin install Cluster…
Installing applications on all nodes.
Successfully installed APP.
begin init Instance…
encrypt cipher and rand files for database.
Please enter password for database:
Please repeat for database:
begin to create CA cert files
The sslcert will be generated in /data/opengauss/app/share/sslcert/om
Cluster installation is completed.
Configuring.
Deleting instances from all nodes.
Successfully deleted instances from all nodes.
Checking node configuration on all nodes.
Initializing instances on all nodes.
Updating instance configuration on all nodes.
Check consistence of memCheck and coresCheck on database nodes.
Successful check consistence of memCheck and coresCheck on all nodes.
Configuring pg_hba on all nodes.
Configuration is completed.
[SUCCESS] hybriddb03:
Using omm:dbgrp to install database.
Using installation program path : /data/opengauss/app_compiled

检查数据库信息

[omm@hybriddb03 ~]$ gsql -d postgres -p 26000 -r

[omm@hybriddb03 opengauss]$ gs_om -t status --detail

开通网络访问权限

vi /data/opengauss/cluster/db1/pg_hba.conf
加入

host all all 0.0.0.0/0 md5

vim /hadoop1/opgs/hadoop1/db1/postgresql.conf

password_encryption_type = 2
改成
password_encryption_type = 0

创建用户

CREATE ROLE manager IDENTIFIED BY ‘Gmcc1234!@#$’;

ALTER ROLE manager SYSADMIN;

ALTER ROLE manager MONADMIN;

ALTER ROLE manager LOGIN;

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5671011.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-16
下一篇 2022-12-16

发表评论

登录后才能评论

评论列表(0条)

保存