openGauss6.0单点企业版部署_Centos7_x86

2024年 4月 22日 51.6k 0

本文档环境:CentOS7.9 x86_64 4G1C40G python2.7.5 交互式初始化环境方式

openGauss 介绍

openGauss是一款开源关系型数据库管理系统,采用木兰宽松许可证v2发行。openGauss内核深度融合华为在数据库领域多年的经验,结合企业级场景需求,持续构建竞争力特性。

openGauss社区版本分为长期支持版本和创新版本:

· 长期支持版本 (LTS) ——规模上线使用,发布间隔周期为1年,提供3年社区支持。

· 社区创新版本 (Preview) ——联创测试使用,发布间隔周期为1年,提供6个月社区支持。

openGauss支持单机部署和单机HA部署两种部署方式。单机部署时,可在一个主机部署多个数据库实例,但为了数据安全,不建议用户这样部署。单机HA部署支持一台主机和最少一台备机,备机一共最多8台的配置方式。

说明: 通过openGauss提供的脚本安装时,只允许在单台物理机部署一个数据库系统。如果您需要在单台物理机部署多个数据库系统,建议您通过命令行安装,不需要通过openGauss提供的安装脚本执行安装。

openGauss 6.0介绍

openGauss 6.0.0-RC1 是社区最新发布的创新版本,版本生命周期为 0.5 年。(创新版本命名:由原方案 XX.1.0 Preview (例:5.1.0 preview),调整为现方案 XX.0.0-RCx),本次发布包含 2 个数据库服务端安装版本:企业版、轻量版,用户可根据使用场景需要下载不同版本,并基于此进行场景化验证,提前发现问题并反馈社区,社区将在下个 LTS 版本发布前进行问题修复,openGauss 6.0.0 LTS 版本将在 2024 年 9 月 30 日进行发布。

openGauss 6.0.0-RC1 自 2023 年 9 月 30 日启动版本开发,历时 6 个月开发周期,凝聚社区 1232 名开发者,累计合入 PR 2794 个,与之前版本特性功能保持兼容,在内核能力、Datapod 三层资源池化架构、DataKit 数据全生命周期管理平台、生态兼容性等方面全面增强。

内核能力增强

企业级特性

存储过程增强:支持存储过程覆盖率测试并输出 html 报告,同时允许创建 procedure 时忽略依赖关系进行创建。 开箱最优:提供 gs_perfconfig 工具辅助对 openGauss 进行性能调整,基于环境信息与业务信息,自动调整操作系统以及数据库参数,达到开箱性能即最优。 其他能力增强:支持龙芯平台编译,支持中文日志;安装易用性提升,支持一站式交互安装,并解除对 root 用户的依赖。

内核四高能力

高性能

分区表性能:在多分区表场景(大于 3000 分区)下,TPCC 数据导入耗时下降 13%,TPCC 性能提升 30%;分区表数据操作(查询、插入、更新、删除等)耗时下降 50%。 主备复制性能:支持 UWAL 组件,利用 RDMA 的 CPU 卸载、内核 Bypass、零拷贝优势,由远程内存直接访问网卡,将 WAL 记录由单边操作传输至远端备库的持久化存储设备,加速主备 XLog 复制;基于 SCM 加速日志持久化,提供 append 语义,大 IO 后拆分后多并发写入,加速 IO 落盘。整体性能提升大于 20%。

高可用

支持异步备升主数据找回能力, 新增 gs_retrieve 工具实现对旧主未同步到异步备的数据通过逻辑解码的方式找回,满足异步备升主场景 RPO≈0。

高智能

新增 dataVec 向量数据库插件,作为为专有大模型的向量数据存储和检索的底座,支持向量数据的存储、 相似度计算,支持针对向量数据建立索引(IVFFLAT),加速查询。

高安全

在鲲鹏服务器上,通过 CPU 加解密指令实现对国密 SM4 算法加速,性能提升约 5%。

DataPod 三层资源池化架构持续创新

支持 SPQ 多机并行查询框架

基于资源池化架构所有节点都共享集群内的资源,支持生成多机执行计划,并将计划分发到各节点执行,查询节点可汇聚各节点数据实现所有读节点并行查询,充分发挥集群的 OLAP 能力,使资源池化同时具备较强的 TP 和 AP 能力,满足资源池化(一主两备)场景下 TPC-H&TPC-DS 相比单节点 SMP 提升大于 2.6 倍。

新增 DMS 资源统计视图

query_all_drc_info:支持收集 DMS 资源池中所有的页面信息和锁信息;get_instr_wait_event:支持收集 DMS 相关命令字的等待时延等信息;query_node_reform_info_from_dms:支持收集 DMS 中 reform 流程相关的状态信息。

DSS 功能增强

DSS 支持 NoF/NoF+协议,支持该协议的 IOFence、文件读写、查询设备信息、适配 CM 和 OM 等能力,用于对接支持该协议的磁盘阵列,典型业务下相比采用 SCSI3 协议的 TPCC 性能提升 10%。 DSS 服务端支持创建线程池;DSS 支持黑匣子诊断,提高运维能力。

容灾能力增强

集群内高可用:支持 XLog 按需回放,实时解析 XLog 构建页面多版本恢复链,在主机故障时备机快速对外提供服务,实现典型业务负载下 RTO>/etc/hosts /etc/security/limits.conf /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/defrag

--加入开机启动
echo '
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/defrag' >>/etc/rc.local
chmod +x /etc/rc.local

防火墙配置

systemctl stop firewalld.service
systemctl disable firewalld.service

如果启用防火墙需进行如下配置:

如果数据库端口和ssh端口不是15400和22,需视情况更改

firewall-cmd --zone=public --add-port=15400/tcp --permanent
firewall-cmd --zone=public --add-port=22/tcp --permanent
firewall-cmd --reload

selinux配置

sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
setenforce 0

关闭 numa和禁用透明大页

sed -i "s/quiet/quiet numa=off transparent_hugepage=never/g" /etc/default/grub
grub2-mkconfig -o /etc/grub2.cfg

设置字符集参数

echo "export LANG=en_US.UTF-8" >> /etc/profile
source /etc/profile

设置时区和时间

如果服务器时间和当前时间相差8小时或者12小时,需要查看时区,分析是否决定更改。

非可视化更改步骤

--查看当前时间
[root@opendb01 ~]# date
Fri Apr 19 14:15:52 CST 2024

--查看当前时区
[root@localhost ~]# timedatectl
Local time: Fri 2024-04-19 14:16:08 CST
Universal time: Fri 2024-04-19 06:16:08 UTC
RTC time: Fri 2024-04-19 06:16:07
Time zone: Asia/Shanghai (CST, +0800)
NTP enabled: n/a
NTP synchronized: no
RTC in local TZ: no
DST active: n/a

--更改时区 执行tzselect命令

root@HKSZF-ZW-172-19-146-176:/topsoft# tzselect
Please identify a location so that time zone rules can be set correctly.
Please select a continent, ocean, "coord", or "TZ".
1) Africa
2) Americas
3) Antarctica
4) Asia
5) Atlantic Ocean
6) Australia
7) Europe
8) Indian Ocean
9) Pacific Ocean
10) coord - I want to use geographical coordinates.
11) TZ - I want to specify the time zone using the Posix TZ format.

--找到Asia,输入4,回车
Please select a country whose clocks agree with yours.
1) Afghanistan 18) Israel 35) Palestine
2) Armenia 19) Japan 36) Philippines
3) Azerbaijan 20) Jordan 37) Qatar
4) Bahrain 21) Kazakhstan 38) Russia
5) Bangladesh 22) Korea (North) 39) Saudi Arabia
6) Bhutan 23) Korea (South) 40) Singapore
7) Brunei 24) Kuwait 41) Sri Lanka
8) Cambodia 25) Kyrgyzstan 42) Syria
9) China 26) Laos 43) Taiwan
10) Cyprus 27) Lebanon 44) Tajikistan
11) East Timor 28) Macau 45) Thailand
12) Georgia 29) Malaysia 46) Turkmenistan
13) Hong Kong 30) Mongolia 47) United Arab Emirates
14) India 31) Myanmar (Burma) 48) Uzbekistan
15) Indonesia 32) Nepal 49) Vietnam
16) Iran 33) Oman 50) Yemen
17) Iraq 34) Pakistan

--找到china,输入9,回车
Please select one of the following time zone regions.
1) Beijing Time
2) Xinjiang Time

--找到北京时间,输入1,回车
Please select one of the following time zone regions.
1) Beijing Time
2) Xinjiang Time

--选择yes,输入1,回车
The following information has been given:

China
Beijing Time

Therefore TZ='Asia/Shanghai' will be used.
Selected time is now: Wed Jan 24 21:40:32 CST 2024.
Universal Time is now: Wed Jan 24 13:40:32 UTC 2024.
Is the above information OK?
1) Yes
2) No

--更新设置
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

--查看是否更改成功
root@HKSZF-ZW-172-19-146-176:/topsoft# date
Fri Apr 19 14:15:52 CST 2024

[root@localhost ~]# timedatectl
Local time: Fri 2024-04-19 14:16:08 CST
Universal time: Fri 2024-04-19 06:16:08 UTC
RTC time: Fri 2024-04-19 06:16:07
Time zone: Asia/Shanghai (CST, +0800)
NTP enabled: n/a
NTP synchronized: no
RTC in local TZ: no
DST active: n/a

可视化更改步骤

--查看当前时间
[root@opendb01 ~]# date
Fri Apr 19 14:43:11 CST 2024

--查看当前时区
[root@localhost ~]# timedatectl
Local time: Fri 2024-04-19 14:43:31 CST
Universal time: Fri 2024-04-19 06:43:31 UTC
RTC time: Fri 2024-04-19 06:43:30
Time zone: Asia/Shanghai (CST, +0800)

在可视化界面中查看

选择进入 Applications -> System Tools -> Settings -> Details -> Date & Time

调整时间

点击“Date & Time”行中任意位置,弹出弹窗,调整时间为当前北京时间,再关闭弹窗,即保存。如下图所示:

再次使用命令查看,本地时间已显示为北京时间

[root@localhost ~]# timedatectl
Local time: Fri 2024-04-19 14:43:31 CST
Universal time: Fri 2024-04-19 06:43:31 UTC
RTC time: Fri 2024-04-19 06:43:30
Time zone: Asia/Shanghai (CST, +0800)
NTP enabled: n/a
NTP synchronized: no
RTC in local TZ: no
DST active: n/a

关闭swap交换内存(可选)

关闭swap交换内存是为了保障数据库的访问性能,避免把数据库的缓冲区内存淘汰到磁盘上。 如果服务器内存比较小,内存过载时,可打开swap交换内存保障正常运行。

swapoff -a

关闭RemoveIPC

在各数据库节点上,关闭RemoveIPC。CentOS操作系统默认为关闭,可以跳过该步骤。

  1. 修改/etc/systemd/logind.conf文件中的“RemoveIPC”值为“no”。a. 使用VIM打开logind.conf文件。

--更改后的/etc/systemd/logind.conf
vim /etc/systemd/logind.conf
RemoveIPC=no

--更改后的
vim /usr/lib/systemd/system/systemd-logind.service
RemoveIPC=no

--重新加载配置参数
systemctl daemon-reload
systemctl restart systemd-logind

--检查修改是否生效
loginctl show-session | grep RemoveIPC
systemctl show systemd-logind | grep RemoveIPC

关闭HISTORY记录(可选)

为避免指令历史记录安全隐患,需关闭各主机的history指令。

更改/etc/profile中HISTSIZE值
vim /etc/profile
HISTSIZE默认值为1000 更改为 HISTSIZE=0

--生效
source /etc/profile

配置yum源

将操作系统镜像上传至/opt目录下

mount /opt/*.iso /mnt/
cat > /etc/fstab
/dev/sr0 /mnt iso9660 loop 0 0
EOF

mkdir -p /etc/yum.repos.d/bak
mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak
cat >> /etc/yum.repos.d/os.repo

gsql”章节。

缺省情况下,客户端连接数据库后处于空闲状态时会根据参数session_timeout的默认值自动断开连接。如果要关闭超时设置,设置参数session_timeout为0即可。默认为0表示关闭超时设置

以操作系统用户omm登录数据库主节点。

su - omm
法一:
gsql -d postgres -p 15400

参数说明:
-d 连接的数据库名称,
-p 数据库主节点的端口号

法二:
gsql -d "host=127.0.0.1 port=15400 dbname=postgres user=omm password=Topnet@123"

--登录后如下:
[omm@localhost ~]$ gsql -d postgres -p 15400
gsql ((openGauss 5.0.1 build 33b035fd) compiled at 2023-12-15 20:19:06 commit 0 last mr )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.

openGauss=# l+
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges | Size | Tablespace |
Description
-----------+-------+----------+------------+------------+-------------------+-------+------------+--------------
------------------------------
postgres | omm | UTF8 | en_US.utf8 | en_US.utf8 | | 13 MB | pg_default | default admin
istrative connection database
template0 | omm | UTF8 | en_US.utf8 | en_US.utf8 | =c/omm +| 13 MB | pg_default | default templ
ate for new databases
| | | | | omm=CTc/omm | | |
template1 | omm | UTF8 | en_US.utf8 | en_US.utf8 | =c/omm +| 13 MB | pg_default | unmodifiable
empty database
| | | | | omm=CTc/omm | | |
(3 rows)

--查看数据库状态
[omm@localhost ~]$ gs_om -t status
-----------------------------------------------------------------------

cluster_name : dbCluster
cluster_state : Normal #“Normal”表示数据库可正常使用
redistributing : No

--创建数据库 不能是en_US.utf8不然报错
openGauss=# create database test with encoding 'utf8' template = template0;
CREATE DATABASE

查数据库版本

--法一
安装目录下查看
cat /topsoft/huawei/install/app/version.cfg

参考链接:https://cloud.tencent.com/developer/article/1822337

https://docs-opengauss.osinfra.cn/zh/docs/5.0.0/docs/InstallationGuide/%E5%88%9D%E5%A7%8B%E5%8C%96%E5%AE%89%E8%A3%85%E7%8E%AF%E5%A2%83.html

相关文章

Oracle如何使用授予和撤销权限的语法和示例
Awesome Project: 探索 MatrixOrigin 云原生分布式数据库
下载丨66页PDF,云和恩墨技术通讯(2024年7月刊)
社区版oceanbase安装
Oracle 导出CSV工具-sqluldr2
ETL数据集成丨快速将MySQL数据迁移至Doris数据库

发布评论