CentOS安装openGauss2.0.1

CentOS安装openGauss2.0.1

OpenGauss是一款开源关系型数据库管理系统,采用木兰宽松许可证v2发行。openGauss内核源自PostgreSQL,深度融合华为在数据库领域多年的经验,结合企业级场景需求,持续构建竞争力特性。
安装前准备:
1、centos7.6+ x86 64位、修改内核
2、修改文件打开数
3、创建普通用户和用户组
4、安装bzip2
2021-4月发布了openGauss安装2.0.1,这里的centos为7.9

一、安装前准备

1.1 修改内核数
在root下,修改centos内核

vi /etc/sysctl.conf
# 修改内核参数,添加如下:(默认参数 250     32000   32      128)
kernel.sem=250     6400000 1000    25600
 
sysctl -p
cat /proc/sys/kernel/sem

1.2 创建用户、用户组文件夹

创建用户和用户组:

# 创建名称为opengaussgroup的组
groupadd -g 1001 opengaussgroup
# 创建名称为opengauss的用户,并添加用户组
useradd -u 2001 -g opengaussgroup opengauss
# 修改用户密码(root下) ,假设修改为agree123
passwd opengauss
 
#创建文件夹:
mkdir /opt/software/openGauss
# 赋予权限
chown -R opengauss:opengaussgroup /opt/software

1.3 修改文件打开数

vi /etc/security/limits.conf
 
# 在最后添加
* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072

PS:
查看文件打开数:ulimit -n
临时生效修改:ulimit -n 65536

提前安装好bzip2和依赖:

yum -y install bzip2
# 安装依赖软件包
yum install libaio-devel flex bison ncurses-devel glibc-devel patch redhat-lsb-core readline-devel -y

然后重启系统。

reboot

二、安装

此时,将用户切换到普通用户su opengauss

2.1 上传安装包

使用1.2节创建的用户来上传安装包到 /opt/software/,执行解压:

su opengauss
tar -jxf openGauss-2.0.1-CentOS-64bit.tar.bz2 -C /opt/software/openGauss

2.2 执行安装

执行安装

# 查看防火墙状态
systemctl status firewalld
# 关闭防火墙
ufw disable
systemctl stop firewalld.service
cd /opt/software/openGauss/simpleInstall
sh install.sh  -w Agree123 -p 5432
# 配置环境变量
echo "PATH=/opt/software/openGauss/bin:\$PATH" >> /home/opengauss/.bash_profile
source /home/opengauss/.bash_profile
# 连接数据库,密码Agree123,端口可修改,默认5432
gsql -d postgres -p 5432 -r

三、管理数据库

3.1 启动/关闭数据库

# 启动
gs_ctl -D /opt/software/openGauss/data/single_node start
# 关闭
gs_ctl -D /opt/software/openGauss/data/single_node stop
# 重启
gs_ctl -D /opt/software/openGauss/data/single_node restart
 
# 连接数据库
gsql -d postgres -p 5432 -r

3.2 配置允许远程连接

cd /opt/software/openGauss/data/single_node
vi pg_hba.conf
# 允许所有网段连接 在IPv4 local connections下添加
host  all    all    0.0.0.0/0    md5
 
vi postgresql.conf
# 将前面#去掉,改为*
listen_addresses = '*'
 
# 允许navicat连接设置,password_encryption_type改为0
password_encryption_type=0
# 重启
gs_ctl -D /opt/software/openGauss/data/single_node restart

# 然后重新修改密码即可
gsql -d postgres -p 5432 -r
su postgres
# 创建用户
CREATE USER agree IDENTIFIED BY 'Lingkang123';
# 查看密码是否MD5保存了
select rolname,rolpassword from pg_authid;
# 修改密码
alter user agree with encrypted password 'Lingkang123456';

四、其他说明

4.1 资料文档

搭建当前最新版本,opengauss 2.0说明了与之前版本保持兼容:
https://opengauss.org/zh/news/2021-04-01/20210401.htmlhttps://opengauss.org/zh/news/2021-04-01/20210401.html

软硬件要求:
https://opengauss.org/zh/docs/2.0.1/docs/installation/%E5%87%86%E5%A4%87%E8%BD%AF%E7%A1%AC%E4%BB%B6%E5%AE%89%E8%A3%85%E7%8E%AF%E5%A2%831.html
1、centos 7.6+
2、提前安装好bzip2:
yum -y install bzip2
3、创建好普通用户,因为opengauss只能在普通用户下安装

极简单节点搭建教程:
https://opengauss.org/zh/docs/2.0.1/docs/installation/%E5%8D%95%E8%8A%82%E7%82%B9%E5%AE%89%E8%A3%85.html

安装完成校验:
https://opengauss.org/zh/docs/2.0.1/docs/installation/%E5%AE%89%E8%A3%85%E9%AA%8C%E8%AF%81.html

posted @ 2022-09-16 00:09  凌康  阅读(237)  评论(0编辑  收藏  举报