嵌入式ARM版本银河麒麟操作系统V10SP1安装OPenGauss数据库

前言:

官网提供了非常完整的openGauss安装步骤。
https://opengauss.org/zh/download/archive/

列举一下个人的使用环境:
麒麟V10
rk3588工控板(ARM)
openGauss-3.0.5(极简版)

浏览一下官网,可以清晰的看到是支持ARM版本的麒麟V10的。
官网的步骤有些分裂,我自己看着也不舒服。所以自己记录一下。
截图中是5.0.1的版本。我自己用的是3.0.5版本。亲测可用。

在这里插入图片描述
在这里插入图片描述

安装前准备

1:关闭操作系统防火墙

使用VIM打开config文件。
sudo vim /etc/selinux/config
修改“SELINUX”的值“disabled”。
SELINUX=disabled
重新启动操作系统。
reboot
检查防火墙是否关闭。
systemctl status firewalld

若防火墙状态显示为active (running),则表示防火墙未关闭,请执行:
systemctl disable firewalld.service
systemctl stop firewalld.service

若防火墙状态显示为inactive (dead),则无需再关闭防火墙。

2:修改字符集

将各数据库节点的字符集设置为相同的字符集,可以在/etc/profile文件中添加“export LANG=XXX”(XXX为Unicode编码)。

sudo vim /etc/profile

export LANG="zh_CN.UTF-8"

3:关闭swap交换空间

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

swapoff -a

4:关闭RemoveIPC

在各数据库节点上,关闭RemoveIPC。

使用VIM打开logind.conf文件。
sudo vim /etc/systemd/logind.conf
修改“RemoveIPC”值为“no”。
RemoveIPC=no

修改/usr/lib/systemd/system/systemd-logind.service文件中的“RemoveIPC”值为“no”。
使用VIM打开systemd-logind.service文件。
sudo vim /usr/lib/systemd/system/systemd-logind.service

修改“RemoveIPC”值为“no”。
RemoveIPC=no

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

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

5:关闭HISTORY记录(可不执行该步骤)


修改 /etc/profile文件。
sudo vim /etc/profile

设置HISTSIZE值为0。例如,系统中HISTSIZE默认值为1000,将其修改为0HISTSIZE=0

保存退出/etc/profile。
:wq

设置/etc/profile生效。
source /etc/profile

使用root用户执行命令
sysctl -w kernel.sem="250 85000 250 330" 

6:创建数据库安装用户和安装路径

# 创建用户与组(组会默认创建)
useradd -d /home/gobills -m gobills
usermod -s /bin/bash gobills

# 设置密码
passwd gobills

7:创建数据库安装路径

# 创建数据库安装路径
mkdir -p /usr/local/db/openGauss
# 为安装路径及文件授权
chown 755 -R /usr/local/db
# 为omm用户授权安装路径权限
chown -R gobills:gobills /usr/local/db/openGauss

8:将安装包上传至麒麟V10系统,并且解压到安装目录

进入安装目录
cd /usr/local/db/openGauss
授权给gobills用户
chown gobills:gobills openGauss-3.0.5-openEuler-64bit.tar.bz2
切换到gobills
su gobills
解压到当前目录
tar -jvx -f openGauss-3.0.5-openEuler-64bit.tar.bz2

开始安装

1:进入解压后目录下的simpleInstall,进行安装。

cd /usr/local/db/openGauss/simpleInstall
sh install.sh  -w "1234567890qQwe" &&source ~/.bashrc

-w:初始化数据库密码(gs_initdb指定),安全需要必须设置。
-p:指定的openGauss端口号,如不指定,默认为5432

2:安装执行完成后,使用ps和gs_ctl查看进程是否正常。

ps ux | grep gaussdb
gs_ctl query -D /usr/local/telewave/openGauss/data/single_node

3:修改配置允许远程连接

# 1.文件 pg_hba.conf 修改
vim /usr/local/db/openGauss/data/single_node/pg_hba.conf
# 允许所有网段连接 在IPv4 local connections下添加
host  all    all    0.0.0.0/0    sha256
host  all    all    0.0.0.0/0    md5
 
# 2.重新加载 gs_ctl 策略
su omm
cd /usr/local/db/openGauss/bin
gs_ctl reload -D /usr/local/db/openGauss/data/single_node
 
# 3.文件 postgresql.conf 修改
vim /usr/local/db/openGauss/data/single_node/postgresql.conf
# 找到 listen_addresses 变量,将前面#去掉
listen_addresses = '*'
# 找到 password_encryption_type 变量,将前面#去掉
password_encryption_type  = 1
 
# 4. 重启数据库
su omm
cd /usr/local/db/openGauss/bin
gs_ctl restart -D  /usr/local/db/openGauss/data/single_node


3:创建数据库远程连接用户

# 进入数据库安装路径的bin目录
cd /usr/local/db/openGauss/bin
# 进入数据库
gsql -d postgres -U gobills -p 5432

# 创建远程连接用户 gobills1
CREATE ROLE gobills1 LOGIN PASSWORD '1234567890qQw';
# 设置gobills1为管理员
GRANT ALL PRIVILEGES TO gobills1;
ALTER USER gobills1 SET search_path = public, pg_catalog;

3:openGauss 常用命令

# 进入数据库安装路径的bin目录
cd /usr/local/db/openGauss/bin

# 查看状态
gs_ctl status -D /usr/local/db/openGauss/data/single_node/

# 启动
gs_ctl start -D /usr/local/db/openGauss/data/single_node/

# 重启
gs_ctl restart -D /usr/local/db/openGauss/data/single_node/

# 停止
gs_ctl stop -D /usr/local/db/openGauss/data/single_node/


安装完成后,即可通过python或图形化客户端连接openGauss数据库详见本人前面2篇博客:

链接: 关于如何使用图形化客户端连接openGauss数据库–手把手超全!!提供下载地址和截图

链接: python如何连接openGauss及django相关配置

  • 9
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值