openEuler22.03安装openGauss-5.0.2(精简版)

openEuler22.03安装openGauss-5.0.2(精简版)

  • 服务器名称:guess
  • IP地址:192.168.195.132
  • 系统首先配置网络,不配置的话无法使用网络,且第三方软件无法连上openGauss的库

1.安装准备

#查看主机名
[root@192 ~]# hostname 
localhost
#设置主机名
[root@192 ~]# hostnamectl set-hostname gauss
# 重启
[root@192 ~] reboot 
#重启后*
[root@node0 ~]# hostname 
gauss
  • 安装依赖包
yum install -y gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel

3.关闭防火墙

  • 目前仅支持在防火墙关闭的状态下进行安装。安装好后,可以把防火墙打开
systemctl disable firewalld.service
systemctl stop firewalld.service
#查看防火墙状态
#1.active(running),开启中
#2.firewalld.关闭中
systemctl status firewalld

4.设置SELINUX

vim /etc/selinux/config 
SELINUX=disabled

5.设置操作系统字符集编码

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

6.关闭swap交换内存(可选)

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

7.关闭RemoveIPC

(1)方式一:

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

  • 删除

    sed -i '/^RemoveIPC/d' /etc/systemd/logind.conf 
    
    sed -i '/^RemoveIPC/d' /usr/lib/systemd/system/systemd-logind.service
    
    
  • 传入参数

    echo "RemoveIPC=no"  >> /etc/systemd/logind.conf 
    
    echo "RemoveIPC=no"  >> /usr/lib/systemd/system/systemd-logind.service
    

(2)方式二:

  • 使用VIM打开logind.conf文件
vim /etc/systemd/logind.conf
修改“RemoveIPC”值为“no”
RemoveIPC=no
  • 使用VIM打开systemd-logind.service文件
vim /usr/lib/systemd/system/systemd-logind.service
修改“RemoveIPC”值为“no”
RemoveIPC=no
8.重新加载配置参数
systemctl daemon-reload
systemctl restart systemd-logind
9.检查修改是否生效
loginctl show-session | grep RemoveIPC
systemctl show systemd-logind | grep RemoveIPC

默认安装的操作系统,2个参数都是RemoveIPC=no,所以这2个参数不用修改,不过需要先查看下参数值,如果不是no,那就手动改下。

10.设置网卡MTU值

  • 将各数据库节点的网卡MTU值设置为相同大小。

​ 执行如下命令查询服务器的网卡名称。

ifconfig
  • 使用如下命令将各数据库节点的网卡MTU值设置为相同大小。MTU值推荐8192,要求不小于1500。
ifconfig ens33 mtu 8192

11.关闭HISTORY记录

  • 为避免指令历史记录安全隐患,需关闭各主机的history指令。
  • 修改根目录下/etc/profile文件。
vim /etc/profile
  • 设置HISTSIZE值为0。例如,系统中HISTSIZE默认值为1000,将其修改为0。
HISTSIZE=0
  1. 保存/etc/profile。

  2. 设置/etc/profile生效。

source /etc/profile

12. 设置root用户远程登录

  • 修改PermitRootLogin配置,允许用户远程登录。(新安装的系统,默认是打开的)
  1. 打开sshd_config文件
vim /etc/ssh/sshd_config
  1. 修改权限配置,可以使用以下两种方式实现:
    注释掉“PermitRootLogin no”。
#PermitRootLogin no
  1. 将“PermitRootLogin”改为“yes”。
PermitRootLogin yes

13.配置Banner

  • 修改Banner配置,去掉连接到系统时,系统提示的信息。
    信息会干扰安装时远程操作的返回结果,影响安装正常执行。
  1. 编辑sshd_config文件。
vim /etc/ssh/sshd_config
  1. 修改Banner配置,注释掉“Banner”所在的行。
#Banner XXXX
  1. 执行:wq保存并退出编辑页面。
    使用如下命令使设置生效。
systemctl restart sshd.service
  1. 以root用户身份重新登录。
ssh xxx.xxx.xxx.xxx

二:获取安装包

官方安装包下载:https://opengauss.org/zh/download/
查看系统版本的指令:
cat /etc/os-release

三:安装

1. 创建用户和用户组

  • 为了实现安装过程中安装账户权限最小化,及安装后openGauss的系统运行安全性,安装脚本在安装过程中会自动按照用户指定内容创建安装用户,并将此用户作为后续运行和维护openGauss的管理员账户。

  • 用户组:dbgrp

​ 初始化安装环境时,由-G参数所指定的安装用户所属的用户组。
​ 该用户组如果不存在,则会自动创建,也可提前创建好用户组。
​ 在执行gs_preinstall脚本时会检查权限。
​ gs_preinstall脚本会自动赋予此组中的用户对安装目录、数据目录的访问和执行权限。

  • 用户:omm

​ 初始化安装环境时,由-U参数所指定和自动创建的操作系统用户。
​ 此用户具备数据库的最高操作权限,此用户初始密码由用户指定。
​ 从安全性考虑,用户所属组是dbgrp
​ 操作:

# 创建用户组
groupadd dbgrp 
# 创建用户
useradd -g dbgrp omm
# 设置密码
echo 'admin@9000' | passwd --stdin omm
  • 创建目录,并把文件上传到/opt/software 最后赋予权限,创建xml文件,
mkdir -p /opt/software

3. 解压安装包

cd /opt/software 

tar -jxf openGauss-5.0.2-openEuler-64bit.tar.bz2
  • 解压出来后赋予文件夹权限
chmod -R 777 /opt/software

四. 开始安装

1. 执行预安装脚本

  • 切换用户,必须使用上面预安装指定的用户进行安装
su – omm
  • 切换到解压目录所在文件夹 cd /opt/software/simpleInstall/
[omm@gauss ~]$ cd /opt/software/simpleInstall/
  • 执行安装命令
sh install.sh  -w "密码" &&source ~/.bashrc
  • 安装完之后查询
ps ux | grep gaussdb
gs_ctl query -D /opt/software/data/single_node
  • 执行ps命令显示如下
omm        16165  7.2 11.6 5957056 881048 ?      Ssl  17:34   0:01 /opt/software/bin/gaussdb -D /opt/software/data/single_node
omm        16267  0.0  0.0  21708  2328 pts/0    S+   17:34   0:00 grep --color=auto gaussdb
  • 执行gs命令显示如下
[omm@gauss software]$ gs_ctl query -D /opt/software/data/single_node
[2024-08-11 17:50:34.189][17568][][gs_ctl]: gs_ctl query ,datadir is /opt/software/data/single_node 
 HA state:           
	local_role                     : Normal
	static_connections             : 0
	db_state                       : Normal
	detail_information             : Normal

 Senders info:       
No information 
 Receiver info:      
No information 
  • 数据库安装完成后,默认生成名称为postgres的数据库。第一次连接数据库时可以连接到此数据库。
  • 其中postgres为需要连接的数据库名称,5432为数据库主节点的端口号
gsql -d postgres -p 5432
  • 连接成功后,系统显示类似如下信息表示数据库连接成功。
[omm@gauss simpleInstall]$ gsql -d postgres -p 5432
gsql ((openGauss 5.0.2 build 48a25b11) compiled at 2024-05-14 10:26:01 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 
-----------+-------+----------+-------------+-------------+-------------------
 finance   | omm   | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 postgres  | omm   | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 school    | omm   | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 template0 | omm   | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/omm           +
           |       |          |             |             | omm=CTc/omm
 template1 | omm   | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/omm           +
           |       |          |             |             | omm=CTc/omm
(5 rows)

openGauss=# \q # 退出数据库命令
  • 9
    点赞
  • 19
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Field error in object 'admin' on field 'id': rejected value [null]; codes [typeMismatch.admin.id,typeMismatch.id,typeMismatch.java.lang.Integer,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [admin.id,id]; arguments []; default message [id]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'java.lang.Integer' for property 'id'; nested exception is java.lang.NumberFormatException: For input string: "null"] at org.springframework.web.method.annotation.ModelAttributeMethodProcessor.resolveArgument(ModelAttributeMethodProcessor.java:157) ~[spring-web-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:124) ~[spring-web-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:161) [spring-web-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:131) [spring-web-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102) [spring-webmvc-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:871) [spring-webmvc-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:777) [spring-webmvc-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) [spring-webmvc-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991) [spring-webmvc-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925) [spring-webmvc-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:978) [spring-webmvc-5.0.2.RELEASE.jar:5.0.2.RELEASE] at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:881) [spring-webmvc-5.0.2.RELEASE.jar:5.0.2.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:652) [servlet-api.jar:4.0.FR] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:855) [spring-webmvc-5.0.2.RELEASE.jar:5.0.2.RELEASE]
05-31
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值