了解openGauss
openGauss是一款全面友好开放,携手伙伴共同打造的企业级开源关系型数据库。openGauss提供面向多核架构的极致性能、全链路的业务、数据安全、基于AI的调优和高效运维的能力。openGauss深度融合华为在数据库领域多年的研发经验,结合企业级场景需求,持续构建竞争力特性。
- openGauss是一个数据库管理系统。
- openGauss数据库是关系型的。
- openGauss软件是开源的。
- openGauss数据库具有高性能、高可用、高安全、易运维、全开放的特点。
环境准备
- VMware 17.5.2
- MobaXterm 22.1
- openEuler-22.03-LTS-SP3
- openGauss_6.0.0-RC1
- 虚拟机
主机名称 | IP |
---|---|
localhost.localdomain | 192.168.192.129 |
- 查看、设置主机名
# 设置主机名
hostnamectl set-hostname localhost.localdomain
# 查看主机名
hostname
# IP
ifconfig
安装依赖包
- expect-5.45.4-7.oe2203sp3.x86_64.rpm
- libaio-0.3.113-9.oe2203sp3.x86_64.rpm
- libaio-devel-0.3.113-9.oe2203sp3.x86_64.rpm
[root@localhost ~]# rpm -ivh expect-5.45.4-7.oe2203sp3.x86_64.rpm
警告:expect-5.45.4-7.oe2203sp3.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID fb37bc6f: NOKEY
Verifying... ################################# [100%]
准备中... ################################# [100%]
正在升级/安装...
1:expect-1:5.45.4-7.oe2203sp3 ################################# [100%]
[root@localhost ~]# rpm -ivh libaio-0.3.113-9.oe2203sp3.x86_64.rpm
警告:libaio-0.3.113-9.oe2203sp3.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID fb37bc6f: NOKEY
Verifying... ################################# [100%]
准备中... ################################# [100%]
软件包 libaio-0.3.113-9.oe2203sp3.x86_64 已经安装
[root@localhost ~]# rpm -ivh libaio-devel-0.3.113-9.oe2203sp3.x86_64.rpm
警告:libaio-devel-0.3.113-9.oe2203sp3.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID fb37bc6f: NOKEY
Verifying... ################################# [100%]
准备中... ################################# [100%]
正在升级/安装...
1:libaio-devel-0.3.113-9.oe2203sp3 ################################# [100%]
[root@localhost ~]# python3 --version
Python 3.9.9
修改操作系统配置
关闭操作系统防火墙
目前仅支持在防火墙关闭的状态下进行安装。
# 查看防火墙状态
[root@localhost ~]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2024-05-30 21:20:41 CST; 35min ago
Docs: man:firewalld(1)
Main PID: 1058 (firewalld)
Tasks: 2 (limit: 21382)
Memory: 34.2M
CGroup: /system.slice/firewalld.service
└─ 1058 /usr/bin/python3 -s /usr/sbin/firewalld --nofork --nopid
5月 30 21:20:37 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon...
5月 30 21:20:41 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.
# 关闭防火墙并禁止开机重启
[root@localhost ~]# systemctl stop firewalld.service
[root@localhost ~]# systemctl disable firewalld.service
Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
# 查看防火墙状态
[root@localhost ~]# systemctl status firewalld
○ firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)
5月 30 21:20:37 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon...
5月 30 21:20:41 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.
5月 30 21:56:02 localhost.localdomain systemd[1]: Stopping firewalld - dynamic firewall daemon...
5月 30 21:56:02 localhost.localdomain systemd[1]: firewalld.service: Deactivated successfully.
5月 30 21:56:02 localhost.localdomain systemd[1]: Stopped firewalld - dynamic firewall daemon.
关闭SELINUX
修改/etc/selinux/config文件中的“SELINUX”值为“disabled”
- 使用vi打开config文件
- 修改“SELINUX”的值“disabled”
[root@localhost ~]# vi /etc/selinux/config
- 重新启动操作系统
[root@192 openEuler]# reboot
设置操作系统字符集
# 设置字符集
[root@localhost ~]# cat>> /etc/profile EOF
[root@localhost ~]#
# 使参数生效
[root@localhost ~]# source /etc/profile
Welcome to 5.10.0-182.0.0.95.oe2203sp3.x86_64
System information as of time: 2024年 05月 31日 星期五 22:27:56 CST
System load: 0.01
Processes: 259
Memory used: 5.1%
Swap used: 0%
Usage On: 4%
IP address: 192.168.192.129
Users online: 2
# 检查字符集
[root@localhost ~]# env |grep -i lang
LANG=en_US.UTF-8
设置时区和时间
# 安装ntp服务
[root@localhost ~]# yum install -y ntp
OS 1.9 kB/s | 2.3 kB 00:01
everything 4.6 kB/s | 2.3 kB 00:00
EPOL 206 B/s | 2.3 kB 00:11
debuginfo 326 B/s | 2.3 kB 00:07
source 1.7 kB/s | 2.3 kB 00:01
update 3.5 kB/s | 2.4 kB 00:00
update 2.6 MB/s | 18 MB 00:06
update-source 575 B/s | 2.4 kB 00:04
update-source 33 kB/s | 292 kB 00:08
Dependencies resolved.
======================================================================================================================================================================================================
....................
Installed:
ntp-4.2.8p15-13.oe2203sp3.x86_64 ntp-help-4.2.8p15-13.oe2203sp3.noarch ntpstat-0.6-4.oe2203sp3.noarch
Complete!
# 开机启动ntp服务
[root@localhost ~]# systemctl enable ntpd
Created symlink /etc/systemd/system/multi-user.target.wants/ntpd.service → /usr/lib/systemd/system/ntpd.service.
[root@localhost ~]#
# 启动ntp服务
[root@localhost ~]# systemctl start ntpd
[root@localhost ~]#
# 设置时区Asia/Shanghai
[root@localhost ~]# timedatectl set-timezone Asia/Shanghai
[root@localhost ~]#
# 检查时区
[root@localhost ~]# timedatectl |grep -i zone
Time zone: Asia/Shanghai (CST, +0800)
[root@localhost ~]#
# 启用ntp服务
[root@localhost ~]# timedatectl set-ntp yes
[root@localhost ~]#
# 编辑定时任务列表
[root@node0 ~]# crontab -e
no crontab for root - using an empty one
crontab: installing new crontab
# 查看时间及时区
[root@localhost ~]# timedatectl status
Local time: Thu 2024-05-30 22:35:39 CST
Universal time: Thu 2024-05-30 14:35:39 UTC
RTC time: Thu 2024-05-30 14:35:40
Time zone: Asia/Shanghai (CST, +0800)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
[root@localhost ~]#
修改硬件时钟
# 将当前系统时间写入硬件时钟
[root@localhost ~]# hwclock --systohc
[root@localhost ~]#
# 查看硬件时钟
[root@localhost ~]# hwclock
2024-05-30 22:37:02.999288+08:00
关闭swap交换内存
关闭swap交换内存是为了保障数据库的访问性能,避免把数据库的缓冲区内存淘汰到磁盘上。 如果服务器内存比较小,内存过载时,可打开swap交换内存保障正常运行。
[root@localhost ~]# swapoff -a
[root@localhost ~]#
设置网卡MTU值
# 设置网卡MTU,MTU值推荐8192,要求不小于1500。
[root@localhost ~]# ifconfig ens33 mtu 8192
[root@localhost ~]#
# 查看网卡MTU
[root@localhost ~]# ifconfig -a |grep -i mtu
ens33: flags=4163 mtu 8192
lo: flags=73 mtu 65536
[root@localhost ~]#
关闭RemoveIPC
- 修改logind.conf文件
# 使用vi打开logind.conf文件
[root@localhost ~]# vi /etc/systemd/logind.conf
[root@localhost ~]#
# 修改“RemoveIPC”值为“no”
[Login]
....................
#IdleActionSec=30min
#RuntimeDirectorySize=10%
#RuntimeDirectoryInodesMax=
RemoveIPC=no
#InhibitorsMax=8192
#SessionsMax=8192
修改systemd-logind.service文件
# 使用vi打开systemd-logind.service文件
[root@localhost ~]# vi /usr/lib/systemd/system/systemd-logind.service
# 修改“RemoveIPC”值为“no”
....................
# Increase the default a bit in order to allow many simultaneous logins since
# we keep one fd open per session.
LimitNOFILE=524288
RemoveIPC=no
# 重新加载配置参数
[root@localhost ~]# systemctl daemon-reload
[root@localhost ~]#
[root@localhost ~]# systemctl restart systemd-logind
[root@localhost ~]#
# 检查修改是否生效
[root@localhost ~]# loginctl show-session | grep RemoveIPC
RemoveIPC=no
[root@localhost ~]#
[root@localhost ~]# systemctl show systemd-logind | grep RemoveIPC
RemoveIPC=no
[root@localhost ~]#
关闭HISTORY记录
为避免指令历史记录安全隐患,需关闭各主机的history指令。
- 修改根目录下/etc/profile文件
[root@localhost ~]# vi /etc/profile
- 设置HISTSIZE值为0
系统中HISTSIZE默认值为1000,将其修改为0。
...................
HOSTNAME=$(/usr/bin/hostnamectl --transient 2>/dev/null) || \
HOSTNAME=$(/usr/bin/hostname 2>/dev/null) || \
HOSTNAME=$(/usr/bin/uname -n)
HISTSIZE=0
if [ "$HISTCONTROL" = "ignorespace" ] ; then
export HISTCONTROL=ignoreboth
else
export HISTCONTROL=ignoredups
fi
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL
...................
- 设置/etc/profile生效
[root@localhost ~]# source /etc/profile
Welcome to 5.10.0-182.0.0.95.oe2203sp3.x86_64
System information as of time: Fri May 31 10:37:25 PM CST 2024
System load: 0.00
Processes: 222
Memory used: 5.2%
Swap used: 0.0%
Usage On: 4%
IP address: 192.168.192.129
Users online: 2
[root@localhost ~]#
设置root用户远程登录
在openGauss安装时需要root帐户远程登录访问权限
数据库需要root互信时才开启远程连接。在各主机操作完成并且验证完毕后请及时注销root用户,避免误操作。
修改PermitRootLogin配置,允许用户远程登录
- 打开sshd_config文件
[root@node0 ~]# vi /etc/ssh/sshd_config
- 修改权限配置
....................
# Authentication:
#LoginGraceTime 2m
PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10
..................
KexAlgorithms curve25519-sha256,curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256
HostbasedAcceptedKeytypes ssh-ed25519,ssh-ed25519-cert-v01@openssh.com,rsa-sha2-256,rsa-sha2-512
GSSAPIKexAlgorithms gss-group14-sha256-,gss-group16-sha512-,gss-curve25519-sha256-
CASignatureAlgorithms ssh-ed25519,sk-ssh-ed25519@openssh.com,rsa-sha2-512,rsa-sha2-256
HostKeyAlgorithms ssh-ed25519,ssh-ed25519-cert-v01@openssh.com,rsa-sha2-256,rsa-sha2-512
PubkeyAcceptedKeyTypes ssh-ed25519,ssh-ed25519-cert-v01@openssh.com,rsa-sha2-256,rsa-sha2-512
修改Banner配置,去掉连接到系统时,系统提示的欢迎信息。欢迎信息会干扰安装时远程操作的返回结果,影响安装正常执行。
- 编辑sshd_config文件
[root@localhost ~]# vi /etc/ssh/sshd_config
- 修改Banner配置,注释掉“Banner”所在的行
.................
ClientAliveCountMax 0
#Banner /etc/issue.net
MACs hmac-sha2-512,hmac-sha2-512-etm@openssh.com,hmac-sha2-256,hmac-sha2-256-etm@openssh.com
StrictModes yes
AllowTcpForwarding no
AllowAgentForwarding no
GatewayPorts no
PermitTunnel no
KexAlgorithms curve25519-sha256,curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256
HostbasedAcceptedKeytypes ssh-ed25519,ssh-ed25519-cert-v01@openssh.com,rsa-sha2-256,rsa-sha2-512
GSSAPIKexAlgorithms gss-group14-sha256-,gss-group16-sha512-,gss-curve25519-sha256-
CASignatureAlgorithms ssh-ed25519,sk-ssh-ed25519@openssh.com,rsa-sha2-512,rsa-sha2-256
HostKeyAlgorithms ssh-ed25519,ssh-ed25519-cert-v01@openssh.com,rsa-sha2-256,rsa-sha2-512
PubkeyAcceptedKeyTypes ssh-ed25519,ssh-ed25519-cert-v01@openssh.com,rsa-sha2-256,rsa-sha2-512
使设置生效
[root@localhost ~]# systemctl restart sshd.service
[root@localhost ~]#
以root用户身份重新登录
[root@localhost ~]# ssh 192.168.192.129
The authenticity of host '192.168.192.129 (192.168.192.129)' can't be established.
ED25519 key fingerprint is SHA256:7Yd1aMVDRktNfShZNk3Kq3xkagL689GBh8ePyhs0RXg.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.192.129' (ED25519) to the list of known hosts.
root@192.168.192.129's password:
Authorized users only. All activities may be monitored and reported.
Activate the web console with: systemctl enable --now cockpit.socket
Last login: Fri May 31 22:26:52 2024 from 192.168.192.1
Welcome to 5.10.0-182.0.0.95.oe2203sp3.x86_64
System information as of time: Fri May 31 10:40:18 PM CST 2024
System load: 0.00
Processes: 224
Memory used: 5.4%
Swap used: 0.0%
Usage On: 4%
IP address: 192.168.192.129
Users online: 3
创建用户和用户组
为了实现安装过程中安装帐户权限最小化,及安装后openGauss的系统运行安全性,安装脚本在安装过程中会自动按照用户指定内容创建安装用户,并将此用户作为后续运行和维护openGauss的管理员帐户。
- 用户组:dbgrp
# 用户组:dbgrp
[root@localhost ~]# groupadd dbgrp
[root@localhost ~]#
# 用户:omm
[root@localhost ~]# useradd -g dbgrp omm
[root@localhost ~]#
[root@localhost ~]# echo 'omm!666' | passwd --stdin omm
Changing password for user omm.
passwd: all authentication tokens updated successfully.
[root@localhost ~]#
[root@localhost ~]# id omm
uid=1001(omm) gid=1001(dbgrp) groups=1001(dbgrp)
创建目录
以root用户登录待安装openGauss的主机,并按规划创建存放安装包的目录。
不建议把安装包的存放目录规划到openGauss用户的根目录或其子目录下,可能导致权限问题。
openGauss用户须具有/opt/software/openGauss目录的读写权限。
[root@localhost ~]# mkdir -p /opt/software/openGauss
[root@localhost ~]#
[root@localhost ~]# chmod 755 -R /opt/software
[root@localhost ~]#
上传安装包
将安装包 openGauss-6.0.0-RC1-openEuler-64bit-all.tar.gz 上传至所创建的/opt/software/openGauss目录中
[root@localhost openGauss]# pwd
/opt/software/openGauss
[root@localhost openGauss]#
[root@localhost openGauss]# ll
total 144640
-rw-r--r-- 1 root root 148111235 May 31 21:24 openGauss-6.0.0-RC1-openEuler-64bit-all.tar.gz
[root@localhost openGauss]#
解压安装包
[root@localhost openGauss]# tar -zxvf openGauss-6.0.0-RC1-openEuler-64bit-all.tar.gz
openGauss-6.0.0-RC1-openEuler-64bit-cm.tar.gz
openGauss-6.0.0-RC1-openEuler-64bit-om.tar.gz
openGauss-6.0.0-RC1-openEuler-64bit.tar.bz2
openGauss-6.0.0-RC1-openEuler-64bit-cm.sha256
openGauss-6.0.0-RC1-openEuler-64bit-om.sha256
openGauss-6.0.0-RC1-openEuler-64bit.sha256
upgrade_sql.tar.gz
upgrade_sql.sha256
[root@localhost openGauss]# tar -zxvf openGauss-6.0.0-RC1-openEuler-64bit-om.tar.gz
./lib/
./lib/pycparser/
./lib/pycparser/__pycache__/
./lib/pycparser/__pycache__/yacctab.cpython-36.pyc
./lib/pycparser/__pycache__/plyparser.cpython-36.pyc
./lib/pycparser/__pycache__/c_lexer.cpython-310.pyc
./lib/pycparser/__pycache__/plyparser.cpython-37.pyc
./lib/pycparser/__pycache__/c_generator.cpython-37.pyc
....................
创建xml文件
- 单节点配置文件
在script/gspylib/etc/conf/cluster_config_template.xml获取XML文件模板,复制XML文件模板到/opt/software/openGauss/目录下,命名为cluster_config.xml
[root@localhost script]# vi cluster_config.xml
执行安装
采用交互模式执行预安装脚本
- 进入script目录
[root@node0 openGauss]# cd /opt/software/openGauss/script
- 执行初始化安装
[root@node0 script]# ./gs_preinstall -U omm -G dbgrp -X /opt/software/openGauss/cluster_config.xml
- 打印信息
[root@localhost script]# ./gs_preinstall -U omm -G dbgrp -X /opt/software/openGauss/cluster_config.xml
Parsing the configuration file.
Successfully parsed the configuration file.
Installing the tools on the local node.
Successfully installed the tools on the local node.
Setting host ip env
Successfully set host ip env.
Are you sure you want to create the user[omm] (yes/no)? yes
.................
Warning: Installation environment contains some warning messages.
Please get more details by "/opt/software/openGauss/script/gs_checkos -i A -h localhost.localdomain -X /opt/software/openGauss/cluster_config.xml --detail".
.................
警告信息处理
查看详情
[root@localhost script]# /opt/software/openGauss/script/gs_checkos -i A -h localhost.localdomain -X /opt/software/openGauss/cluster_config.xml --detail
Checking items:
.................
A6. [ System control parameters status ] : Warning
[localhost.localdomain]
Warning reason: variable 'net.ipv4.tcp_retries1' RealValue '3' ExpectedValue '5'.
Warning reason: variable 'net.ipv4.tcp_syn_retries' RealValue '6' ExpectedValue '5'.
Check_SysCtl_Parameter warning.
A7. [ File system configuration status ] : Warning
[localhost.localdomain]
Warning reason: variable 'open files' RealValue '1024' ExpectedValue '1000000'
Warning reason: variable 'max user processes' RealValue '13364' ExpectedValue 'unlimited'
.................
A12.[ Time consistency status ] : Warning
[localhost.localdomain]
The NTPD not detected on machine and local time is "2024-05-31 23:21:28".
.................
Total numbers:14. Abnormal numbers:0. Warning numbers:3.
A6警告信息
A6. [ System control parameters status ] : Warning
# 操作系统参数设置
[root@localhost script]# echo net.ipv4.tcp_retries1 = 5 >>/etc/sysctl.conf
[root@localhost script]# echo net.ipv4.tcp_syn_retries = 5 >>/etc/sysctl.conf
# 使参数生效
[root@localhost script]# sysctl -p
kernel.sysrq = 0
net.ipv4.ip_forward = 0
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.default.send_redirects = 0
net.ipv4.conf.all.accept_source_route = 0
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.default.accept_redirects = 0
net.ipv4.conf.all.secure_redirects = 0
net.ipv4.conf.default.secure_redirects = 0
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.icmp_ignore_bogus_error_responses = 1
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.default.rp_filter = 1
net.ipv4.tcp_syncookies = 1
kernel.dmesg_restrict = 1
net.ipv6.conf.all.accept_redirects = 0
net.ipv6.conf.default.accept_redirects = 0
net.ipv4.tcp_max_tw_buckets = 10000
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_keepalive_time = 30
net.ipv4.tcp_keepalive_intvl = 30
net.ipv4.tcp_retries2 = 12
net.ipv4.ip_local_reserved_ports = 15400-15407,20050-20057
net.core.wmem_max = 21299200
net.core.rmem_max = 21299200
net.core.wmem_default = 21299200
net.core.rmem_default = 21299200
kernel.sem = 250 6400000 1000 25600
net.ipv4.tcp_rmem = 8192 250000 16777216
net.ipv4.tcp_wmem = 8192 250000 16777216
vm.min_free_kbytes = 172852
net.core.netdev_max_backlog = 65535
net.ipv4.tcp_max_syn_backlog = 65535
net.core.somaxconn = 65535
kernel.shmall = 1152921504606846720
kernel.shmmax = 18446744073709551615
net.ipv4.tcp_retries1 = 5
net.ipv4.tcp_syn_retries = 5
A7警告信息
A7. [ File system configuration status ] : Warning
[root@node0 script]# ulimit -a
real-time non-blocking time (microseconds, -R) unlimited
core file size (blocks, -c) unlimited
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 13365
max locked memory (kbytes, -l) 65536
max memory size (kbytes, -m) unlimited
open files (-n) 1000000
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 13365
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
[root@node0 script]# echo "* soft nofile 1000000" >>/etc/security/limits.conf
[root@node0 script]# echo "* hard nofile 1000000" >>/etc/security/limits.conf
重新打开一个会话窗口
[root@node0 ~]# ulimit -a
real-time non-blocking time (microseconds, -R) unlimited
core file size (blocks, -c) unlimited
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 13365
max locked memory (kbytes, -l) 65536
max memory size (kbytes, -m) unlimited
open files (-n) 1000000
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) unlimited
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
A12警告信息
A12.[ Time consistency status ] : Warning
- 查看ntp状态,发现ntp没有启动
[root@localhost script]# systemctl status ntpd
○ ntpd.service - Network Time Service
Loaded: loaded (/usr/lib/systemd/system/ntpd.service; disabled; vendor preset: disabled)
Active: inactive (dead) since Fri 2024-05-31 22:33:28 CST; 56min ago
Main PID: 2099 (code=exited, status=0/SUCCESS)
May 31 22:33:05 localhost.localdomain ntpd[2099]: Listen normally on 3 ens33 192.168.192.129:123
May 31 22:33:05 localhost.localdomain ntpd[2099]: Listen normally on 4 lo [::1]:123
May 31 22:33:05 localhost.localdomain ntpd[2099]: Listen normally on 5 ens33 [fe80::20c:29ff:fe01:a3a5%2]:123
May 31 22:33:05 localhost.localdomain ntpd[2099]: Listening on routing socket on fd #22 for interface updates
May 31 22:33:05 localhost.localdomain ntpd[2099]: kernel reports TIME_ERROR: 0x41: Clock Unsynchronized
May 31 22:33:05 localhost.localdomain ntpd[2099]: kernel reports TIME_ERROR: 0x41: Clock Unsynchronized
May 31 22:33:05 localhost.localdomain systemd[1]: Started Network Time Service.
May 31 22:33:28 localhost.localdomain systemd[1]: Stopping Network Time Service...
May 31 22:33:28 localhost.localdomain systemd[1]: ntpd.service: Deactivated successfully.
May 31 22:33:28 localhost.localdomain systemd[1]: Stopped Network Time Service.
- 启动ntp服务
[root@localhost script]# systemctl start ntpd
[root@localhost script]#
# 查看ntp状态
[root@localhost script]# systemctl status ntpd
● ntpd.service - Network Time Service
Loaded: loaded (/usr/lib/systemd/system/ntpd.service; disabled; vendor preset: disabled)
Active: active (running) since Fri 2024-05-31 23:30:36 CST; 9s ago
Process: 10516 ExecStart=/usr/sbin/ntpd -u ntp:ntp $OPTIONS (code=exited, status=0/SUCCESS)
Main PID: 10518 (ntpd)
Tasks: 2 (limit: 21382)
Memory: 752.0K
CGroup: /system.slice/ntpd.service
└─ 10518 /usr/sbin/ntpd -u ntp:ntp -g
May 31 23:30:36 localhost.localdomain ntpd[10518]: Listen and drop on 0 v6wildcard [::]:123
May 31 23:30:36 localhost.localdomain ntpd[10518]: Listen and drop on 1 v4wildcard 0.0.0.0:123
May 31 23:30:36 localhost.localdomain ntpd[10518]: Listen normally on 2 lo 127.0.0.1:123
May 31 23:30:36 localhost.localdomain ntpd[10518]: Listen normally on 3 ens33 192.168.192.129:123
May 31 23:30:36 localhost.localdomain ntpd[10518]: Listen normally on 4 lo [::1]:123
May 31 23:30:36 localhost.localdomain ntpd[10518]: Listen normally on 5 ens33 [fe80::20c:29ff:fe01:a3a5%2]:123
May 31 23:30:36 localhost.localdomain ntpd[10518]: Listening on routing socket on fd #22 for interface updates
May 31 23:30:36 localhost.localdomain ntpd[10518]: kernel reports TIME_ERROR: 0x41: Clock Unsynchronized
May 31 23:30:36 localhost.localdomain ntpd[10518]: kernel reports TIME_ERROR: 0x41: Clock Unsynchronized
May 31 23:30:36 localhost.localdomain systemd[1]: Started Network Time Service.
- 查看ntp状态,如果发现ntp没有安装
- 安装ntp服务
- 启动ntp服务
重新执行初始化安装
- 进入script目录
- 执行初始化安装
[root@localhost script]# ./gs_preinstall -U omm -G dbgrp -X /opt/software/openGauss/cluster_config.xml
# 打印信息
Parsing the configuration file.
Successfully parsed the configuration file.
Installing the tools on the local node.
Successfully installed the tools on the local node.
Setting host ip env
Successfully set host ip env.
Are you sure you want to create the user[omm] (yes/no)? yes
.................
无警告信息
执行安装
# 切换至omm用户
[root@localhost script]# su - omm
Last login: Fri May 31 23:37:20 CST 2024
Welcome to 5.10.0-182.0.0.95.oe2203sp3.x86_64
System information as of time: 2024年 05月 31日 星期五 23:38:49 CST
System load: 0.20
Processes: 236
Memory used: 6.5%
Swap used: 0.0%
Usage On: 6%
IP address: 192.168.192.129
Users online: 3
To run a command as administrator(user "root"),use "sudo ".
[omm@localhost ~]$
# 执行安装
# gs_install -X /opt/software/openGauss/cluster_config.xml --gsinit-parameter="--locale=en_US.utf8"
# 此处密码设置为:openGauss!666
[omm@localhost ~]$ gs_install -X /opt/software/openGauss/cluster_config.xml --gsinit-parameter="--locale=en_US.utf8"
Parsing the configuration file.
Successfully checked gs_uninstall on every node.
Check preinstall on every node.
Successfully checked preinstall on every node.
Creating the backup directory.
Successfully created the backup directory.
begin deploy..
Installing the cluster.
begin prepare Install Cluster..
Checking the installation environment on all nodes.
begin install Cluster..
Installing applications on all nodes.
Successfully installed APP.
begin init Instance..
encrypt cipher and rand files for database.
# 设置数据库密码
Please enter password for database:
# 确认数据库密码
Please repeat for database:
begin to create CA cert files
The sslcert will be generated in /opt/huawei/install/app/share/sslcert/om
NO cm_server instance, no need to create CA for CM.
Non-dss_ssl_enable, no need to create CA for DSS
Cluster installation is completed.
Configuring.
Deleting instances from all nodes.
Successfully deleted instances from all nodes.
Checking node configuration on all nodes.
Initializing instances on all nodes.
Updating instance configuration on all nodes.
Check consistence of memCheck and coresCheck on database nodes.
Configuring pg_hba on all nodes.
Configuration is completed.
The cluster status is Normal.
Successfully started cluster.
Successfully installed application.
end deploy..
安装验证
查看数据库启动状态
通过openGauss提供的gs_om工具可以完成数据库状态检查
以omm用户身份登录服务器
检查数据库状态是否正常
[omm@localhost ~]$ gs_om -t status --detail
[ Cluster State ]
cluster_state : Normal
redistributing : No
current_az : AZ_ALL
[ Datanode State ]
node node_ip port instance state
------------------------------------------------------------------------------------------------------------
1 localhost.localdomain 192.168.192.129 15400 6001 /opt/huawei/install/data/dn P Primary Normal
- 服务器IP地址: 192.168.192.129
- 数据库的端口号: 15400
- 数据库数据路径: /opt/huawei/install/data/dn
- P: 安装时指定的角色为Primary
- Primary: 实例为主实例
- Normal: openGauss可用
登录数据库
数据库安装完成后,默认生成名称为postgres的数据库。第一次连接数据库时可以连接到此数据库。
[omm@localhost ~]$ gsql -d postgres -p 15400
gsql ((openGauss 6.0.0-RC1 build ed7f8e37) compiled at 2024-03-31 12:44:26 commit 0 last mr )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.
openGauss=# select version();
version
-----------------------------------------------------------------------------------------------------------------------------------------------------------
(openGauss 6.0.0-RC1 build ed7f8e37) compiled at 2024-03-31 12:44:26 commit 0 last mr on x86_64-unknown-linux-gnu, compiled by g++ (GCC) 10.3.0, 64-bit
(1 row)
openGauss=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+-------+----------+------------+------------+-------------------
postgres | omm | UTF8 | en_US.utf8 | en_US.utf8 |
template0 | omm | UTF8 | en_US.utf8 | en_US.utf8 | =c/omm +
| | | | | omm=CTc/omm
template1 | omm | UTF8 | en_US.utf8 | en_US.utf8 | =c/omm +
| | | | | omm=CTc/omm
(3 rows)
openGauss=# select sysdate;
sysdate
---------------------
2024-05-31 23:50:31
(1 row)
openGauss=#
- postgres: openGauss安装完成后默认生成的数据库。初始可以连接到此数据库进行新数据库的创建。
- 15400: 数据库主节点的端口号!
在VMware虚拟机中安装openEuler-22.03-LTS-SP3
实战:在Kylin桌面版操作系统中配置openGauss的ODBC数据源
Navicat连接openGauss_5.0.0 企业版数据库
记录在openEuler-22.03中安装openGauss_5.0.0企业版
在VMware 17.0.2虚拟机中安装openEuler-22.03-LTS-SP2