猿创征文 | 国产数据库之openGauss的单机主备部署及快速入门

一、openGauss介绍

1.openGauss简介

1.openGauss是一款开源关系型数据库管理系统,采用木兰宽松许可证v2发行。
2.openGauss是一款支持SQL2003标准语法,支持主备部署的高可用关系型数据库。

2.openGauss特点

1.高可靠:故障切换时间RTO<10s。
2.高性能:两路鲲鹏性能150万tpmC。
3.易运维:基于AI的智能参数调优。
4.高安全:端到端全方位安全防护。

3.openGauss的逻辑架构图

在这里插入图片描述

二、环境检查

1.节点规划

hostname IP地址 备注
master 192.168.3.201 极简版——一主一备节点

2.操作系统版本

[root@master ~]# cat /etc/os-release 
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

三、安装前环境配置

1.检查admin普通用户

[root@master simpleInstall]# id admin
uid=1000(admin) gid=1000(admin) groups=1000(admin)

2.给安装目录授权

chown  -R admin:admin /data/openGauss/
chown -R admin:admin /opt/software/openGauss

3.配置/etc/sysctl.conf文件

[root@master openGauss]# vim /etc/sysctl.conf 
[root@master openGauss]# cat /etc/sysctl.conf 
# sysctl settings are defined through files in
# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
#
# Vendors settings live in /usr/lib/sysctl.d/.
# To override a whole file, create a new file with the same in
# /etc/sysctl.d/ and put new settings there. To override
# only specific settings, add a file with a lexically later
# name in /etc/sysctl.d/ and put new settings there.
#
# For more information, see sysctl.conf(5) and sysctl.d(5).
net.ipv4.ip_forward=1
kernel.sem = 250 32000 100 999
[root@master openGauss]# sysctl -p
net.ipv4.ip_forward = 1
kernel.sem = 250 32000 100 999

4.配置/etc/hosts

[root@master soft]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.3.201 master

四、下载openGauss软件包

1.进入官网下载

在这里插入图片描述

2.将软件包上传到master节点

[root@master soft]# pwd
/data/openGauss/soft
[root@master soft]# ll
total 87720
-rw-r--r-- 1 root root 89822788 Oct  3 17:19 openGauss-3.1.0-CentOS-64bit.tar.bz2


3.切换admin用户

[root@master openGauss]# su - admin
[admin@master ~]$ cd /data/openGauss/
[admin@master openGauss]$ ls
openGauss-3.1.0-CentOS-64bit.tar.bz2
[admin@master openGauss]$ pwd
/data/openGauss

4.解压软件包

[admin@master openGauss]$ tar -xjf openGauss-3.1.0-CentOS-64bit.tar.bz2  -C /opt/software/openGauss
[admin@master openGauss]$ ls /opt/software/openGauss/
bin  etc  include  jre  lib  share  simpleInstall  version.cfg




五、执行openGauss安装

1.进入simpleInstall目录

[admin@master openGauss]$ cd /opt/software/openGauss/simpleInstall/
[admin@master simpleInstall]$ ls
finance.sql  install.sh  README.md  school.sql




2.安装simpleInstall

sh install.sh  -w Admin.123456  --multinode

-w:初始化数据库密码(gs_initdb指定),安全需要必须设置。
-p:指定的openGauss主节点端口号,默认5432。备节点端口号会使用主端口号+200,默认5632。
–multinode:用来区分是单节点还是一主一备安装。

3.openGauss安装过程

[admin@master simpleInstall]$ sh install.sh  -w Admin.123456  --multinode
[step 1]: check parameter
[step 2]: check install env and os setting
[step 3]: change_gausshome_owner
[step 4]: set environment variables

/home/admin/.bashrc: line 16: ulimit: open files: cannot modify limit: Operation not permitted
[init primary datanode.]
The files belonging to this database system will be owned by user "admin".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.UTF-8".
The default text search configuration will be set to "english".

creating directory /opt/software/openGauss/data/master ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 32MB
creating configuration files ... ok
Begin init undo subsystem meta.
[INIT UNDO] Init undo subsystem meta successfully.
creating template1 database in /opt/software/openGauss/data/master/base/1 ... 2022-10-03 20:49:33.719 [unknown] [unknown] localhost 140536644539520 0[0:0#0]  [BACKEND] WARNING:  macAddr is 12/691646992, sysidentifier is 796985/2987452422, randomNum is 2160584710
ok
initializing pg_authid ... ok
setting password ... ok
initializing dependencies ... ok
loading PL/pgSQL server-side language ... ok
creating system views ... ok
creating performance views ... ok
loading system objects' descriptions ... ok
creating collations ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
initialize global configure for bucketmap length ... ok
creating information schema ... ok
loading foreign-data wrapper for distfs access ... ok
loading foreign-data wrapper for log access ... ok
loading hstore extension ... ok
loading foreign-data wrapper for MOT access ... ok
loading security plugin ... ok
update system tables ... ok
creating snapshots catalog ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok
freezing database template0 ... ok
freezing database template1 ... ok
freezing database postgres ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run gs_initdb.

Success. You can now start the database server of single node using:

    gaussdb -D /opt/software/openGauss/data/master --single_node
or
    gs_ctl start -D /opt/software/openGauss/data/master -Z single_node -l logfile

[init slave datanode.]
The files belonging to this database system will be owned by user "admin".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.UTF-8".
The default text search configuration will be set to "english".

creating directory /opt/software/openGauss/data/slave ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 32MB
creating configuration files ... ok
Begin init undo subsystem meta.
[INIT UNDO] Init undo subsystem meta successfully.
creating template1 database in /opt/software/openGauss/data/slave/base/1 ... 2022-10-03 20:49:42.064 [unknown] [unknown] localhost 140200454964352 0[0:0#0]  [BACKEND] WARNING:  macAddr is 12/691646992, sysidentifier is 796985/2987423942, randomNum is 4257577158
ok
initializing pg_authid ... ok
setting password ... ok
initializing dependencies ... ok
loading PL/pgSQL server-side language ... ok
creating system views ... ok
creating performance views ... ok
loading system objects' descriptions ... ok
creating collations ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
initialize global configure for bucketmap length ... ok
creating information schema ... ok
loading foreign-data wrapper for distfs access ... ok
loading foreign-data wrapper for log access ... ok
loading hstore extension ... ok
loading foreign-data wrapper for MOT access ... ok
loading security plugin ... ok
update system tables ... ok
creating snapshots catalog ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok
freezing database template0 ... ok
freezing database template1 ... ok
freezing database postgres ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run gs_initdb.

Success. You can now start the database server of single node using:

    gaussdb -D /opt/software/openGauss/data/slave --single_node
or
    gs_ctl start -D /opt/software/openGauss/data/slave -Z single_node -l logfile

[config datanode.]
remote_read_mode = non_authentication
host    all             all             192.168.3.201/32            trust
[start primary datanode.]
[2022-10-03 20:49:49.982][10855][][gs_ctl]: gs_ctl started,datadir is /opt/software/openGauss/data/master 
[2022-10-03 20:49:50.012][10855][][gs_ctl]: waiting for server to start...
.0 LOG:  [Alarm Module]can not read GAUSS_WARNING_TYPE env.
	
0 LOG:  [Alarm Module]Host Name: master 
	
0 LOG:  [Alarm Module]Host IP: master. Copy hostname directly in case of taking 10s to use 'gethostbyname' when /etc/hosts does not contain <HOST IP>
	
0 LOG:  [Alarm Module]Cluster Name: dbCluster 
	
0 LOG:  [Alarm Module]Invalid data in AlarmItem file! Read alarm English name failed! line: 57
	
0 WARNING:  failed to open feature control file, please check whether it exists: FileName=gaussdb.version, Errno=2, Errmessage=No such file or directory.
0 WARNING:  failed to parse feature control file: gaussdb.version.
0 WARNING:  Failed to load the product control file, so gaussdb cannot distinguish product version.
2022-10-03 20:49:50.078 [unknown] [unknown] localhost 140295358137472 0[0:0#0]  0 [BACKEND] LOG:  when starting as multi_standby mode, we couldn't support data replicaton.
gaussdb.state does not exist, and skipt setting since it is optional.2022-10-03 20:49:50.085 [unknown] [unknown] localhost 140295358137472 0[0:0#0]  0 [BACKEND] LOG:  [Alarm Module]can not read GAUSS_WARNING_TYPE env.
	
2022-10-03 20:49:50.085 [unknown] [unknown] localhost 140295358137472 0[0:0#0]  0 [BACKEND] LOG:  [Alarm Module]Host Name: master 
	
2022-10-03 20:49:50.085 [unknown] [unknown] localhost 140295358137472 0[0:0#0]  0 [BACKEND] LOG:  [Alarm Module]Host IP: master. Copy hostname directly in case of taking 10s to use 'gethostbyname' when /etc/hosts does not contain <HOST IP>
	
2022-10-03 20:49:50.085 [unknown] [unknown] localhost 140295358137472 0[0:0#0]  0 [BACKEND] LOG:  [Alarm Module]Cluster Name: dbCluster 
	
2022-10-03 20:49:50.085 [unknown] [unknown] localhost 140295358137472 0[0:0#0]  0 [BACKEND] LOG:  [Alarm Module]Invalid data in AlarmItem file! Read alarm English name failed! line: 57
	
2022-10-03 20:49:50.087 [unknown] [unknown] localhost 140295358137472 0[0:0#0]  0 [BACKEND] LOG:  loaded library "security_plugin"
2022-10-03 20:49:50.088 [unknown] [unknown] localhost 140295358137472 0[0:0#0]  0 [BACKEND] WARNING:  could not create any HA TCP/IP sockets
2022-10-03 20:49:50.089 [unknown] [unknown] localhost 140295358137472 0[0:0#0]  0 [BACKEND] LOG:  InitNuma numaNodeNum: 1 numa_distribute_mode: none inheritThreadPool: 0.
2022-10-03 20:49:50.089 [unknown] [unknown] localhost 140295358137472 0[0:0#0]  0 [BACKEND] LOG:  reserved memory for backend threads is: 220 MB
2022-10-03 20:49:50.089 [unknown] [unknown] localhost 140295358137472 0[0:0#0]  0 [BACKEND] LOG:  reserved memory for WAL buffers is: 128 MB
2022-10-03 20:49:50.089 [unknown] [unknown] localhost 140295358137472 0[0:0#0]  0 [BACKEND] LOG:  Set max backend reserve memory is: 348 MB, max dynamic memory is: 11071 MB
2022-10-03 20:49:50.089 [unknown] [unknown] localhost 140295358137472 0[0:0#0]  0 [BACKEND] LOG:  shared memory 356 Mbytes, memory context 11419 Mbytes, max process memory 12288 Mbytes
2022-10-03 20:49:50.103 [unknown] [unknown] localhost 140295358137472 0[0:0#0]  0 [CACHE] LOG:  set data cache  size(402653184)
2022
  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 8
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

江湖有缘

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值