暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

openGauss-5.0.3极简版安装部署笔记

心有星汉 2024-09-16
363

IMG_256

简介

了解openGauss

openGauss是一款全面友好开放,携手伙伴共同打造的企业级开源关系型数据库。openGauss提供面向多核架构的极致性能、全链路的业务、数据安全、基于AI的调优和高效运维的能力。openGauss深度融合华为在数据库领域多年的研发经验,结合企业级场景需求,持续构建竞争力特性。openGauss网站 (https://opengauss.org/zh/ ) 提供了有关openGauss软件的最新信息。

openGauss是一个数据库管理系统。

数据库是结构化的数据集合。它可以是任何数据,购物清单、图片库或公司网络中的大量信息。要添加、访问和处理存储在计算机数据库中的海量数据,您需要一个数据库管理系统(DBMS)。数据库管理系统可以对数据库进行统一的管理和控制,以保证数据库的安全性和完整性。由于计算机非常擅长处理大量数据,因此数据库管理系统可以作为独立程序使用,也可以作为其他应用程序的一部分在计算中发挥着核心作用。

openGauss数据库是关系型的。

关系型数据库是指采用了关系模型来组织数据的数据库,其以行和列的形式存储数据。行和列被称为表,一组表组成了数据库。关系模型可以简单理解为二维表格模型,而一个关系型数据库就是由二维表及其之间的关系组成的一个数据组织。

openGauss的SQL部分代表 “结构化查询语言”。SQL是最常用的用于访问和处理数据库的标准计算机语言。根据您的编程环境,您可以直接输入SQL、将SQL语句嵌入到以另一种语言编写的代码中,或者使用包含SQL语法的特定语言 API。

SQL由ANSI/ISO SQL标准定义。SQL标准自1986年以来一直在发展,并且存在多个版本。本手册中,“SQL92”是指1992年发布的标准,“SQL99”是指1999年发布的标准,“SQL2003”是指2003年发布的标准。“SQL2011”是指该标准的当前版本。openGauss支持标准的SQL92/SQL99/SQL2003/SQL2011规范。

openGauss软件是开源的。

开源意味着任何人都可以使用和修改软件。任何人都可以下载openGauss软件并使用它,而无需支付任何费用。如果您愿意,您可以研究源代码并对其进行更改以满足您的需要。openGauss软件使用木兰宽松许可证V2(http://license.coscl.org.cn/MulanPSL2)来定义软件的使用范围。

openGauss数据库具有高性能、高可用、高安全、易运维、全开放的特点。

高性能

      • 提供了面向多核架构的并发控制技术,结合鲲鹏硬件优化方案,在两路鲲鹏下,TPCC Benchmark可以达到150万tpmc的性能。
      • 针对当前硬件多核numa的架构趋势, 在内核关键结构上采用了Numa-Aware的数据结构。
      • 提供Sql-bypass智能快速引擎技术。
      • 针对数据频繁更新的场景,提供Ustore存储引擎。

高可用

      • 支持主备同步、异步以及级联备机多种部署模式。
      • 数据页CRC校验,损坏数据页通过备机自动修复。
      • 备机并行恢复,10秒内可升主提供服务。
      • 提供基于paxos分布式一致性协议的日志复制及选主框架。

高安全

支持全密态计算,访问控制、加密认证、数据库审计、动态数据脱敏等安全特性,提供全方位端到端的数据安全保护。

易运维

      • 基于AI的智能参数调优和索引推荐,提供AI自动参数推荐。
      • 慢SQL诊断,多维性能自监控视图,实时掌控系统的性能表现。
      • 提供在线自学习的SQL时间预测。

全开放

      • 采用木兰宽松许可证协议,允许对代码自由修改,使用,引用。
      • 数据库内核能力全开放。
      • 提供丰富的伙伴认证,培训体系和高校课程。

安装

本文安装系统以CentOS 7.9版本,openGauss 5.0.3版本为例

安装环境

目前,openGauss仅支持ARM服务器和基于x86_64通用PC服务器

  • x86服务器:
    • CentOS 7.6

获取安装包

  • 安装包下载地址:https://opengauss.org/zh/download/
  • 选择5.0.3版本对应平台企业版安装包下载

123

安装步骤

1.安装依赖包

依赖如下表

所需软件

建议版本

libaio-devel

建议版本:0.3.109-13

flex

要求版本:2.5.31 以上

bison

建议版本:2.7-4

ncurses-devel

建议版本:5.9-13.20130511

glibc-devel

建议版本:2.17-111

patch

建议版本:2.7.1-10

redhat-lsb-core

建议版本:4.1

readline-devel

建议版本:7.0-13

libnsl(openEuler+x86环境中)

建议版本:2.28-36

安装命令

挂载ISO镜像到/mnt目录

[root@localhost ~]# mount -t auto /dev/cdrom /mnt/

创建本地yum仓库配置文件

cd /etc/yum.repos.d/

mkdir -p /tmp/yumbak

mv *.repo /tmp/yumbak

cat << EOF > /etc/yum.repos.d/local.repo

[local]

name=Local Repository

baseurl=file:///mnt

enabled=1

gpgcheck=0

EOF

清理yum缓存并生成新的缓存:

yum clean all

yum makecache

安装依赖包

[root@localhost ~]# yum install -y libaio-devel flex bison ncurses-devel glibc-devel patch redhat-lsb-core lsb_release readline-devel expect

2.关闭操作系统防火墙

为了在防火墙开启的状态下,确保openGauss的正常使用,用户需要将同openGauss相关的服务、协议、IP以及端口添加到openGauss主机的防火墙白名单中。

# 查看防火墙状态,如果是dead那就是关闭的,如果不是就需要继续执行下面的代码

[root@localhost ~]# systemctl status firewalld

# 关闭防火墙

[root@localhost ~]# systemctl disable firewalld.service

[root@localhost ~]# systemctl stop firewalld.service

3.关闭 selinux

# 如果没有安装VIM,请安装VIM

[root@localhost ~]# yum install vim -y

# 1.使用VIM打开config文件

[root@localhost ~]# vim /etc/selinux/config

# 2.修改“SELINUX”的值“disabled”,执行:wq保存并退出修改

# 3.重新启动操作系统

[root@localhost ~]# reboot

4.设置字符集参数

# 1.使用VIM打开profile文件

[root@localhost ~]# vim /etc/profile

# 2.在/etc/profile文件中添加“export LANG=en_US.UTF-8”

[root@localhost ~]# source /etc/profile

5.设置时区和时间

# 使用如下命令将各数据库节点/usr/share/zoneinfo/目录下的时区文件拷贝为/etc/localtime文件

[root@localhost ~]# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

6.创建普通用户和目录,并授权

# 使用root创建用户并设置用户密码

[root@localhost ~]# groupadd -g 1100 omm

[root@localhost ~]# useradd -u 1100 -g omm omm

[root@localhost ~]# passwd omm

#创建安装目录

[root@localhost ~]# mkdir -p /opt/software

[root@localhost ~]# mkdir -p /opt/openGauss

# 授权

[root@localhost ~]# chmod 755 -R /opt/software

[root@localhost ~]# chown -R omm:omm /opt/openGauss

7.单节点安装

使用root用户登录到openGauss包安装的主机,解压openGauss压缩包到安装目录

# 把下载好的安装包拷贝到服务器上

cd /root

tar -zxvf openGauss-5.0.3-CentOS-64bit-all.tar.gz

# 安装 bzip2

[root@localhost openGauss]# yum -y install bzip2

[root@localhost openGauss]# tar -jxf openGauss-5.0.3-CentOS-64bit.tar.bz2 -C /opt/openGauss

chown -R omm:omm /opt/openGauss

su - omm

进入解压后目录下的simpleInstall目录,执行install.sh脚本安装openGauss

[omm@localhost simpleInstall]$ cd /opt/openGauss/simpleInstall

[omm@localhost simpleInstall]$ sh install.sh -w "openGauss1234"

[omm@localhost simpleInstall]$ source ~/.bashrc

安装时的错误提示

  • password must be at least 8 character and at least three kinds 密码至少8个字符,至少3种类型
  • Error: can not install openGauss with root 使用普通用户安装,不能使用root用户安装
  • install.sh: line 352: load.log: Permission denied 普通用户没有解压路径、安装路径的读、写和执行操作权限
  • the maximum number of SEMMNI is not correct, the current SEMMNI is xxx. Please check it 使用有root权限的用户执行如下命令sysctl -w kernel.sem="250 85000 250 330"
  • -bash: ulimit: open files: cannot modify limit: Operation not permitted使用omm用户执行如下命令vim ~/.bashrc删除ulimit -n 1000000

8.查看安装是否成功

[omm@localhost simpleInstall]$ ps -ef |grep gauss

omm 13446 1 5 00:30 ? 00:01:53 /opt/openGauss/bin/gaussdb -D /opt/openGauss/data/single_node

omm 15956 13156 0 01:07 pts/0 00:00:00 grep --color=auto gauss

数据库使用

连接数据库

# 5432为默认端口号

[omm@localhost simpleInstall]$ gsql -d postgres -p 5432

简单使用

创建用户

执行 create user 用户名 with password "密码" 创建用户

openGauss=# create user openg with password "openg@1234";

CREATE ROLE

创建数据库

执行 create database 数据库名 owner 所属用户 创建数据库

openGauss=# create database test owner openg;

CREATE DATABASE

创建表并测试

openGauss=# \c test openg;

Password for user openg:

Non-SSL connection (SSL connection is recommended when requiring high-security)

You are now connected to database "test" as user "openg".

test=# create schema student authorization openg;

CREATE SCHEMA

test=# create table student.student(id int,name varchar(100));

CREATE TABLE

test=# insert into student.student values (1,'lisi');

INSERT 0 1

test=# select * from student.student;

id | name

----+------

1 | lisi

(1 row)

最后修改时间:2024-10-03 18:50:05
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

文章被以下合辑收录

评论