1 您需要了解
- VMware Workstation 版本:
16.2.0
- OS 版本:
openEuler-20.03-LTS-SP2
,访问 openEuler官网 进行操作系统下载 - DB 版本:
OpenGauss 2.1.0 企业版
,访问 openGauss官网 进行数据库下载,文件名openGauss-2.1.0-openEuler-64bit-all.tar.gz
- OpenEuler 虚拟机可连通外网,方便使用在线YUM源(未联网情况下可配置本地YUM源)
- OpenEuler
必须
使用英文操作系统(默认),当前openGauss
安装包只能在英文操作系统上安装使用 - OpenEuler 建议使用
20.03 LTS
系列版本(python 版本为 3.7.x),openGauss 在 openEuler 上目前仅支持python 3.7.x
版本,其他系列版本的操作系统不满足对python版本的要求,可以手工配置,但对于初学者不友好 - 您可请参考下方 G015 博文完成 OpenEuler 操作系统安装,版本系列不同,但步骤相同
-
为有更好的浏览体验,您可以点击文章左上方
目录
按钮来显示文章整体目录结构 - 相关文章
- G015-OS-LIN-EULER-01 openEuler 21.03 欧拉 Linux 安装
2 系统环境配置
2.1 IP及主机名
[root@cloudcsp ~]# echo '192.168.200.174 cloudcsp' >> /etc/hosts
[root@cloudcsp ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.200.174 cloudcsp
2.2 关闭防火墙
[root@cloudcsp ~]# systemctl stop firewalld
[root@cloudcsp ~]# systemctl disable firewalld
Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.
2.3 设置字符集及其他环境变量
[root@cloudcsp ~]# vi /etc/profile
# 末尾添加以下环境变量
export LANG=en_US.UTF-8
export packagePath=/opt/software/openGauss
export LD_LIBRARY_PATH=$packagePath/script/gspylib/clib:$LD_LIBRARY_PATH
# 刷新当前环境变量
[root@cloudcsp ~]# source /etc/profile
2.4 取消内存限制参数
[root@cloudcsp ~]# vi /etc/profile.d/performance.sh
# 将第一行最小内存限制参数注释掉
#sysctl -w vm.min_free_kbytes=112640 &> /dev/null
sysctl -w vm.dirty_ratio=60 &> /dev/null
sysctl -w kernel.sched_autogroup_enabled=0 &> /dev/null
2.5 更换python版本
安装过程中会配置 openGauss 用户互信,openEuler 需要用到 python 3.7.x
版本命令,但默认版本为 2.7.x
,所以需要更换。
[root@cloudcsp ~]# python -V
Python 2.7.18
[root@cloudcsp ~]# ls -l /usr/bin/python*
lrwxrwxrwx. 1 root root 7 Jun 24 2021 /usr/bin/python -> python2
lrwxrwxrwx. 1 root root 9 Jun 24 2021 /usr/bin/python2 -> python2.7
-rwxr-xr-x. 1 root root 14376 Jun 24 2021 /usr/bin/python2.7
-rwxr-xr-x. 1 root root 1846 Jun 24 2021 /usr/bin/python2.7-config
-rwxr-xr-x. 1 root root 14384 Jun 24 2021 /usr/bin/python2.7-debug
-rwxr-xr-x. 1 root root 1852 Jun 24 2021 /usr/bin/python2.7-debug-config
lrwxrwxrwx. 1 root root 16 Jun 24 2021 /usr/bin/python2-config -> python2.7-config
lrwxrwxrwx. 1 root root 15 Jun 24 2021 /usr/bin/python2-debug -> python2.7-debug
lrwxrwxrwx. 1 root root 22 Jun 24 2021 /usr/bin/python2-debug-config -> python2.7-debug-config
lrwxrwxrwx. 1 root root 9 Jun 24 2021 /usr/bin/python3 -> python3.7
-rwxr-xr-x. 2 root root 14376 Jun 24 2021 /usr/bin/python3.7
-rwxr-xr-x. 2 root root 14376 Jun 24 2021 /usr/bin/python3.7m
lrwxrwxrwx. 1 root root 14 Jun 24 2021 /usr/bin/python-config -> python2-config
lrwxrwxrwx. 1 root root 13 Jun 24 2021 /usr/bin/python-debug -> python2-debug
lrwxrwxrwx. 1 root root 20 Jun 24 2021 /usr/bin/python-debug-config -> python2-debug-config
# 更换 python 软链文件
[root@cloudcsp ~]# mv /usr/bin/python /usr/bin/python.bak
[root@cloudcsp ~]# ln -s /usr/bin/python3 /usr/bin/python
[root@cloudcsp ~]# ls -l /usr/bin/python*
lrwxrwxrwx 1 root root 16 Jul 19 14:13 /usr/bin/python -> /usr/bin/python3
lrwxrwxrwx. 1 root root 9 Jun 24 2021 /usr/bin/python2 -> python2.7
-rwxr-xr-x. 1 root root 14376 Jun 24 2021 /usr/bin/python2.7
-rwxr-xr-x. 1 root root 1846 Jun 24 2021 /usr/bin/python2.7-config
-rwxr-xr-x. 1 root root 14384 Jun 24 2021 /usr/bin/python2.7-debug
-rwxr-xr-x. 1 root root 1852 Jun 24 2021 /usr/bin/python2.7-debug-config
lrwxrwxrwx. 1 root root 16 Jun 24 2021 /usr/bin/python2-config -> python2.7-config
lrwxrwxrwx. 1 root root 15 Jun 24 2021 /usr/bin/python2-debug -> python2.7-debug
lrwxrwxrwx. 1 root root 22 Jun 24 2021 /usr/bin/python2-debug-config -> python2.7-debug-config
lrwxrwxrwx. 1 root root 9 Jun 24 2021 /usr/bin/python3 -> python3.7
-rwxr-xr-x. 2 root root 14376 Jun 24 2021 /usr/bin/python3.7
-rwxr-xr-x. 2 root root 14376 Jun 24 2021 /usr/bin/python3.7m
lrwxrwxrwx. 1 root root 7 Jun 24 2021 /usr/bin/python.bak -> python2
lrwxrwxrwx. 1 root root 14 Jun 24 2021 /usr/bin/python-config -> python2-config
lrwxrwxrwx. 1 root root 13 Jun 24 2021 /usr/bin/python-debug -> python2-debug
lrwxrwxrwx. 1 root root 20 Jun 24 2021 /usr/bin/python-debug-config -> python2-debug-config
[root@cloudcsp ~]# python -V
Python 3.7.9
2.6 安装相关软件包
[root@cloudcsp ~]# yum install -y libaio* \
tar \
vim \
net*
3 安装 openGauss 数据库
3.1 上传并解压软件
[root@cloudcsp ~]# mkdir -p /opt/software/openGauss
# 上传软件至此目录
[root@cloudcsp ~]# ls -l /opt/software/openGauss/
total 104948
-rw-r--r-- 1 root root 107466525 Mar 11 10:01 openGauss-2.1.0-openEuler-64bit-all.tar.gz
[root@cloudcsp ~]# chmod 755 -R /opt/software
[root@cloudcsp ~]# ls -l /opt/software/openGauss/
total 104948
-rwxr-xr-x 1 root root 107466525 Mar 11 10:01 openGauss-2.1.0-openEuler-64bit-all.tar.gz
[root@cloudcsp ~]# cd /opt/software/openGauss/
[root@cloudcsp openGauss]# tar -zxvf openGauss-2.1.0-openEuler-64bit-all.tar.gz
openGauss-2.1.0-openEuler-64bit-om.tar.gz
openGauss-2.1.0-openEuler-64bit.tar.bz2
openGauss-2.1.0-openEuler-64bit-om.sha256
openGauss-2.1.0-openEuler-64bit.sha256
upgrade_sql.tar.gz
upgrade_sql.sha256
[root@cloudcsp openGauss]# tar -zxvf openGauss-2.1.0-openEuler-64bit-om.tar.gz
[root@cloudcsp openGauss]# ll
total 206M
drwx------ 14 root root 4.0K Sep 30 2021 lib
-rwxr-xr-x 1 root root 103M Mar 11 10:01 openGauss-2.1.0-openEuler-64bit-all.tar.gz
-rw------- 1 root root 65 Sep 30 2021 openGauss-2.1.0-openEuler-64bit-om.sha256
-rw------- 1 root root 19M Sep 30 2021 openGauss-2.1.0-openEuler-64bit-om.tar.gz
-rw------- 1 root root 65 Sep 30 2021 openGauss-2.1.0-openEuler-64bit.sha256
-rw------- 1 root root 85M Sep 30 2021 openGauss-2.1.0-openEuler-64bit.tar.bz2
drwx------ 6 root root 4.0K Sep 30 2021 script
drwx------ 2 root root 4.0K Sep 30 2021 simpleInstall
-rw------- 1 root root 65 Sep 30 2021 upgrade_sql.sha256
-rw------- 1 root root 221K Sep 30 2021 upgrade_sql.tar.gz
-rw------- 1 root root 32 Sep 30 2021 version.cfg
3.2 创建 XML 文件
安装前需创建 XML 文件,包含集群名称、服务器名称、安装路径、IP及端口号等,用于告知 openGauss 如何安装,以下为单节点配置方案。如果采用公有云弹性云服务器部署,需要注意 azName
区域名称,和弹性云服务器所在实际 AZ
保持一致;本地虚拟化部署,可忽略。
[root@cloudcsp openGauss]# vim clusterconfig.xml
[root@cloudcsp openGauss]# cat clusterconfig.xml
<?xml version="1.0" encoding="UTF-8"?>
<ROOT>
<CLUSTER>
<PARAM name="clusterName" value="dbCluster" />
<PARAM name="nodeNames" value="cloudcsp" />
<PARAM name="backIp1s" value="192.168.200.174"/>
<PARAM name="gaussdbAppPath" value="/opt/gaussdb/app" />
<PARAM name="gaussdbLogPath" value="/var/log/gaussdb" />
<PARAM name="gaussdbToolPath" value="/opt/huawei/wisequery" />
<PARAM name="corePath" value="/opt/opengauss/corefile"/>
<PARAM name="clusterType" value="single-inst"/>
</CLUSTER>
<DEVICELIST>
<DEVICE sn="1000001">
<PARAM name="name" value="cloudcsp"/>
<PARAM name="azName" value="AZ1"/>
<PARAM name="azPriority" value="1"/>
<PARAM name="backIp1" value="192.168.200.174"/>
<PARAM name="sshIp1" value="192.168.200.174"/>
<!--dbnode-->
<PARAM name="dataNum" value="1"/>
<PARAM name="dataPortBase" value="26000"/>
<PARAM name="dataNode1" value="/gaussdb/data/db1"/>
</DEVICE>
</DEVICELIST>
</ROOT>
3.3 创建 omm 用户及 dbgrp 组
omm
用户为操作系统用户,也是未来 openGauss 数据库管理员账户,dbgrp
是运行 openGauss 操作系统用户的群组名称。
[root@cloudcsp openGauss]# python /opt/software/openGauss/script/gs_preinstall -U omm -G dbgrp -X /opt/software/openGauss/clusterconfig.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 pssh path
Successfully set core path.
Are you sure you want to create the user[omm] and create trust for it (yes/no)? yes
Please enter password for cluster user.
Password:
Please enter password for cluster user again.
Password:
Successfully created [omm] user on all nodes.
Preparing SSH service.
Successfully prepared SSH service.
Checking OS software.
Successfully check os software.
Checking OS version.
Successfully checked OS version.
Creating cluster's path.
Successfully created cluster's path.
Set and check OS parameter.
Setting OS parameters.
Successfully set OS parameters.
Warning: Installation environment contains some warning messages.
Please get more details by "/opt/software/openGauss/script/gs_checkos -i A -h cloudcsp --detail".
Set and check OS parameter completed.
Preparing CRON service.
Successfully prepared CRON service.
Setting user environmental variables.
Successfully set user environmental variables.
Setting the dynamic link library.
Successfully set the dynamic link library.
Setting Core file
Successfully set core path.
Setting pssh path
Successfully set pssh path.
Setting Cgroup.
Successfully set Cgroup.
Set ARM Optimization.
No need to set ARM Optimization.
Fixing server package owner.
Setting finish flag.
Successfully set finish flag.
Preinstallation succeeded.
3.4 创建数据库
安装脚本 gs_install 必须以 omm
执行,否则执行脚本会报错。
[root@cloudcsp openGauss]# chmod -R 755 /opt/software/openGauss/script/
[root@cloudcsp openGauss]# su - omm
[omm@cloudcsp ~]$ cd /opt/software/openGauss/script/
# 使用 install 工具配置数据库
gs_install -X /opt/software/openGauss/clusterconfig.xml \
--gsinit-parameter="--encoding=UTF8" \
--dn-guc="max_process_memory=4GB" \
--dn-guc="shared_buffers=256MB" \
--dn-guc="bulk_write_ring_size=256MB" \
--dn-guc="cstore_buffers=16MB"
# 输出
Parsing the configuration file.
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/gaussdb/app/share/sslcert/om
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.
Successfully started cluster.
Successfully installed application.
end deploy..
3.5 连接数据库
- 查看数据库实例信息
[omm@cloudcsp script]$ 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 cloudcsp 192.168.200.174 26000 6001 /gaussdb/data/db1 P Primary Normal
- 通过
gsql
连接数据库
[omm@cloudcsp script]$ gsql -d postgres -p 26000 -r
gsql ((openGauss 2.1.0 build 590b0f8e) compiled at 2021-09-30 14:29:54 commit 0 last mr )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.
openGauss=# \db
List of tablespaces
Name | Owner | Location
------------+-------+----------
pg_default | omm |
pg_global | omm |
(2 rows)
openGauss=# \q
- END