开发者
资源
openGauss2.0.0极简版安装
openGauss2.0.0极简版安装
发表于2023/12/31
2891

openGauss2.0.0极简版安装

openGauss 2.0.0 版本中(2021.03.31发布)新增了极简版软件包,相对企业版安装流程更简单快捷,更加适合高校学生或者个人功能测试的场景,该软件包中不含OM工具,采用脚本就可以实现一键式安装部署。

本文通过使用极简版进行安装部署,希望基本的操作示例对大家能有所帮助。

软件环境: 包含了上一版本(1.1.0版本)要求的软件依赖包,新增了openEuler x86环境下需要的libnsl软件包。

硬件环境: 极简版中对于硬件环境要求描述“个人开发者最低配置2核4G, 推荐配置4核8G。”,本次安装实验采用最低配置2c/4GB,操作系统使用CentOS7.6.1810。

极简版为了适应小内存机器,在部署时将部分重要内存参数设置较低,如:“shared_buffers = 32MB”、“cstore_buffers = 512MB”。

另外,极简版安装的数据库字符集将原先默认的SQL_ACSII字符集改为en_US.UTF-8,同时初始用户密码不做强制修改[modify_initial_password = false]。

运行环境配置

1. 配置YUM源

mkdir /etc/yum.repos.d/bak

mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak/

wget -O /etc/yum.repos.d/CentOS-Base.repo https://repo.huaweicloud.com/repository/conf/CentOS-7-reg.repo

yum clean all

2. 安装依赖的软件包

yum install libaio-devel flex bison ncurses-devel glibc-devel patch redhat-lsb-core readline-devel -y

3. 关闭安全设置

## 关闭防火墙

systemctl status firewalld

systemctl disable firewalld.service

systemctl stop firewalld.service

## 关闭SELinux

sed -i '/SELINUX=/d' /etc/selinux/config

echo "SELINUX=disabled" >> /etc/selinux/config

cat /etc/selinux/config|grep -v ^#|grep -v '^$'

创建普通用户和目录,并授权

groupadd -g 1001 dbgrp

useradd -u 2001 -g dbgrp omm

mkdir -p /opt/software/openGauss

chown -R omm:dbgrp /opt

解压并一键式安装单机openGauss

极简版软件包:openGauss-2.0.0-CentOS-64bit.tar.bz2

企业版软件包:openGauss-2.0.0-CentOS-64bit-all.tar.gz (包含om工具)

单机部署的数据目录 –> /opt/software/openGauss/data/single_node

主备部署的数据目录 –> /opt/software/openGauss/data/master 和 /opt/software/openGauss/data/slave

## 解压软件包

[root@db1 ~]# su - omm

[omm@db1 ~]$ cd /opt/software/openGauss/

[omm@db1 openGauss]$ tar -jxf openGauss-2.0.0-CentOS-64bit.tar.bz2 -C /opt/software/openGauss/

## 一键式脚本安装

[omm@db1 openGauss]$ cd /opt/software/openGauss/simpleInstall/

[omm@db1 simpleInstall]$ sh install.sh -w gauss@123 -p 26000 ## -w指定数据库初始用户密码、-p指定数据库端口

[step 1]: check parameter

[step 2]: check install env and os setting

[step 3]: change_gausshome_owner

[step 4]: set environment variables

/home/omm/.bashrc: line 16: ulimit: open files: cannot modify limit: Operation not permitted

[step 6]: init datanode

The files belonging to this database system will be owned by user "omm".

This user must also own the server process.

The database cluster will be initialized with locale "en_US.UTF-8".

The default database encoding has accordingly been set to "UTF8".

The default text search configuration will be set to "english".

creating directory /opt/software/openGauss/data/single_node ... ok

creating subdirectories ... ok

selecting default max_connections ... 100

selecting default shared_buffers ... 32MB

creating configuration files ... ok

creating template1 database in /opt/software/openGauss/data/single_node/base/1 ... The core dump path is an invalid directory

2021-04-01 09:58:57.927 [unknown] [unknown] localhost 139899531253504 0 [BACKEND] WARNING: macAddr is 64022/1040773698, sysidentifier is 4195761672/4064452798, randomNum is 486318270

... ...

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/single_node --single_node

or

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

[step 7]: start datanode

[2021-04-01 09:59:21.027][8464][][gs_ctl]: gs_ctl started,datadir is /opt/software/openGauss/data/single_node

[2021-04-01 09:59:21.136][8464][][gs_ctl]: waiting for server to start...

0 LOG: [Alarm Module]can not read GAUSS_WARNING_TYPE env.

0 LOG: [Alarm Module]Host Name: db1

0 LOG: [Alarm Module]Host IP: 127.0.0.1

0 LOG: [Alarm Module]Cluster Name: dbCluster

0 LOG: [Alarm Module]Invalid data in AlarmItem file! Read alarm English name failed! line: 52

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.

0 LOG: Failed to initialze environment for codegen.

The core dump path is an invalid directory

2021-04-01 09:59:21.359 [unknown] [unknown] localhost 140033854506752 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.2021-04-01 09:59:21.359 [unknown] [unknown] localhost 140033854506752 0 0 [BACKEND] LOG: [Alarm Module]can not read GAUSS_WARNING_TYPE env.

2021-04-01 09:59:21.359 [unknown] [unknown] localhost 140033854506752 0 0 [BACKEND] LOG: [Alarm Module]Host Name: db1

2021-04-01 09:59:21.359 [unknown] [unknown] localhost 140033854506752 0 0 [BACKEND] LOG: [Alarm Module]Host IP: 127.0.0.1

2021-04-01 09:59:21.359 [unknown] [unknown] localhost 140033854506752 0 0 [BACKEND] LOG: [Alarm Module]Cluster Name: dbCluster

2021-04-01 09:59:21.359 [unknown] [unknown] localhost 140033854506752 0 0 [BACKEND] LOG: [Alarm Module]Invalid data in AlarmItem file! Read alarm English name failed! line: 52

2021-04-01 09:59:21.359 [unknown] [unknown] localhost 140033854506752 0 0 [BACKEND] LOG: Transparent encryption disabled.

2021-04-01 09:59:21.365 [unknown] [unknown] localhost 140033854506752 0 0 [BACKEND] LOG: loaded library "security_plugin"

2021-04-01 09:59:21.365 [unknown] [unknown] localhost 140033854506752 0 0 [BACKEND] WARNING: could not create any HA TCP/IP sockets

2021-04-01 09:59:21.374 [unknown] [unknown] localhost 140033854506752 0 0 [BACKEND] WARNING: No explicit IP is configured for listen_addresses GUC.

2021-04-01 09:59:21.374 [unknown] [unknown] localhost 140033854506752 0 0 [BACKEND] LOG: InitNuma numaNodeNum: 1 numa_distribute_mode: none inheritThreadPool: 0.

2021-04-01 09:59:21.374 [unknown] [unknown] localhost 140033854506752 0 0 [BACKEND] LOG: reserved memory for backend threads is: 220 MB

2021-04-01 09:59:21.374 [unknown] [unknown] localhost 140033854506752 0 0 [BACKEND] LOG: reserved memory for WAL buffers is: 128 MB

2021-04-01 09:59:21.374 [unknown] [unknown] localhost 140033854506752 0 0 [BACKEND] LOG: Set max backend reserve memory is: 348 MB, max dynamic memory is: 11097 MB

2021-04-01 09:59:21.374 [unknown] [unknown] localhost 140033854506752 0 0 [BACKEND] LOG: shared memory 330 Mbytes, memory context 11445 Mbytes, max process memory 12288 Mbytes

2021-04-01 09:59:21.404 [unknown] [unknown] localhost 140033854506752 0 0 [CACHE] LOG: set data cache size(402653184)

2021-04-01 09:59:21.415 [unknown] [unknown] localhost 140033854506752 0 0 [CACHE] LOG: set metadata cache size(134217728)

2021-04-01 09:59:21.462 [unknown] [unknown] localhost 140033854506752 0 0 [BACKEND] LOG: gaussdb: fsync file "/opt/software/openGauss/data/single_node/gaussdb.state.temp" success

2021-04-01 09:59:21.462 [unknown] [unknown] localhost 140033854506752 0 0 [BACKEND] LOG: create gaussdb state file success: db state(STARTING_STATE), server mode(Normal)

2021-04-01 09:59:21.483 [unknown] [unknown] localhost 140033854506752 0 0 [BACKEND] LOG: max_safe_fds = 977, usable_fds = 1000, already_open = 13

The core dump path is an invalid directory

2021-04-01 09:59:21.484 [unknown] [unknown] localhost 140033854506752 0 0 [BACKEND] LOG: user configure file is not found, it will be created.

2021-04-01 09:59:21.488 [unknown] [unknown] localhost 140033854506752 0 0 [BACKEND] LOG: the configure file /opt/software/openGauss/etc/gscgroup_omm.cfg doesn't exist or the size of configure file has changed. Please create it by root user!

2021-04-01 09:59:21.488 [unknown] [unknown] localhost 140033854506752 0 0 [BACKEND] LOG: Failed to parse cgroup config file.

[2021-04-01 09:59:22.143][8464][][gs_ctl]: done

[2021-04-01 09:59:22.143][8464][][gs_ctl]: server started (/opt/software/openGauss/data/single_node)

import sql file

Would you like to create a demo database (yes/no)? yes ## 创建Demo数据库

Load demoDB [school,finance] success.

[complete successfully]: You can start or stop the database server using:

gs_ctl start|stop|restart -D $GAUSSHOME/data/single_node -Z single_node

检查数据库

[omm@db1 ~]$ echo "PATH=/opt/software/openGauss/bin:\$PATH" >> /home/omm/.bash_profile ## 配置PATH

[omm@db1 ~]$ source ~/.bash_profile

-bash: ulimit: open files: cannot modify limit: Operation not permitted ## 这里提示打开文件数量限制不能修改,这...... 代表resource limit参数脚本也没有做相应的配置

[omm@db1 ~]$ gsql -d postgres -p 26000 -r

gsql ((openGauss 2.0.0 build 78689da9) compiled at 2021-03-31 21:04:03 commit 0 last mr )

Non-SSL connection (SSL connection is recommended when requiring high-security)

Type "help" for help.

postgres=# \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的极简安装没有使用OM工具,即可以不使用OM工具对openGauss实例进行管理和配置。

openGauss极简版免去了用户配置XML文件的操作,也免去了配置1主+1备的配置操作,这简化了安装操作。

附录:极简安装主备环境

openGauss极简主备部署,脚本的基本操作就是分别单机安装主、备节点,然后配置主备关系并重建备库。同时,极简安装也会部署测试库finance和school。

[omm@db1 ~]$ cd /opt/software/openGauss/

[omm@db1 openGauss]$ tar -jxf openGauss-2.0.0-CentOS-64bit.tar.bz2 -C /opt/software/openGauss/

[omm@db1 openGauss]$ cd /opt/software/openGauss/simpleInstall/

## 主备部署需要配合--multinode参数

[omm@db1 simpleInstall]$ sh install.sh -w gauss@123 -p 26000 --multinode

[step 1]: check parameter

[step 2]: check install env and os setting

[step 3]: change_gausshome_owner

[step 4]: set environment variables

/home/omm/.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 "omm".

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

creating template1 database in /opt/software/openGauss/data/master/base/1 ... The core dump path is an invalid directory

... ...

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 "omm".

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

creating template1 database in /opt/software/openGauss/data/slave/base/1 ... The core dump path is an invalid directory

2021-04-01 10:16:31.046 [unknown] [unknown] localhost 140719588914944 0 [BACKEND] WARNING: macAddr is 64022/1040773698, sysidentifier is 4195761672/4064474332, randomNum is 2212623580

... ...

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.0.100/32 trust

[start primary datanode.]

[2021-04-01 10:16:53.293][1997][][gs_ctl]: gs_ctl started,datadir is /opt/software/openGauss/data/master

[2021-04-01 10:16:53.400][1997][][gs_ctl]: waiting for server to start...

......

[2021-04-01 10:17:10.092][2063][datanode2][gs_ctl]: done

[2021-04-01 10:17:10.092][2063][datanode2][gs_ctl]: server started (/opt/software/openGauss/data/slave)

[2021-04-01 10:17:10.092][2063][datanode2][gs_ctl]: fopen build pid file "/opt/software/openGauss/data/slave/gs_build.pid" success

[2021-04-01 10:17:10.092][2063][datanode2][gs_ctl]: fprintf build pid file "/opt/software/openGauss/data/slave/gs_build.pid" success

[2021-04-01 10:17:10.095][2063][datanode2][gs_ctl]: fsync build pid file "/opt/software/openGauss/data/slave/gs_build.pid" success

import sql file

Would you like to create a demo database (yes/no)? yes

Load demoDB [school,finance] success.

[complete successfully]: You can start or stop the database server using:

primary: gs_ctl start|stop|restart -D $GAUSSHOME/data/master -M primary

standby: gs_ctl start|stop|restart -D $GAUSSHOME/data/slave -M standby

-> 数据库检查

[omm@db1 ~]$ echo "PATH=/opt/software/openGauss/bin:\$PATH" >> /home/omm/.bash_profile ## 配置PATH

[omm@db1 ~]$ source ~/.bash_profile

[omm@db1 master]$ gsql -d postgres -p 26000 -r

postgres=# \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

-> 主备状态检查

[omm@db1 master]$ gs_ctl query -D /opt/software/openGauss/data/master

[2021-04-01 10:32:43.785][2239][][gs_ctl]: gs_ctl query ,datadir is /opt/software/openGauss/data/master

HA state:

local_role : Primary

static_connections : 1

db_state : Normal

detail_information : Normal

Senders info:

sender_pid : 2151

local_role : Primary

peer_role : Standby

peer_state : Normal

state : Streaming

sender_sent_location : 0/403B850

sender_write_location : 0/403B850

sender_flush_location : 0/403B850

sender_replay_location : 0/403B850

receiver_received_location : 0/403B850

receiver_write_location : 0/403B850

receiver_flush_location : 0/403B850

receiver_replay_location : 0/403B850

sync_percent : 100%

sync_state : Sync

sync_priority : 1

sync_most_available : Off

channel : 192.168.0.100:26001-->192.168.0.100:37014

Receiver info:

No information

收藏举报
Level 1
0
帖子
0
粉丝
0
获赞