教学文章
Technology Exchange
热门课程
400电话

免费咨询热线
400-090-9964

教学文章

安装openGauss:准备安装用户及环境

时间:2020-08-17 来源:

创建完openGauss配置文件后,在执行安装前,为了后续能以最小权限进行安装及openGauss管理操作,保证系统安全性,需要运行安装前置脚本gs_preinstall准备好安装用户及环境。

安装前置脚本gs_preinstall可以协助用户自动完成如下的安装环境准备工作:

自动设置Linux内核参数以达到提高服务器负载能力的目的。这些参数直接影响数据库系统的运行状态,请仅在确认必要时调整。openGauss所设置的Linux内核参数取值请参见配置操作系统参数。

自动将openGauss配置文件、安装包拷贝到openGauss主机的相同目录下。

openGauss安装用户、用户组不存在时,自动创建安装用户以及用户组。

读取openGauss配置文件中的目录信息并创建,将目录权限授予安装用户。

前提条件

已完成安装准备的所有任务。

注意事项

用户需要检查上层目录权限,保证安装用户对安装包和配置文件目录读写执行的权限。

xml文件中各主机的名称与IP映射配置正确。

只能使用root用户执行gs_preinstall命令。

操作步骤

1.以root用户登录待安装openGauss的任意主机,并按规划创建存放安装包的目录。

mkdir -p /opt/software/openGauss

chmod 755 -R /opt/software

说明:

- 不建议把安装包的存放目录规划到openGauss用户的家目录或其子目录下,可能导致权限问题。

- openGauss用户须具有/opt/software/openGauss目录的读写权限。

2.以release包为例,将安装包“openGauss_x.x.x_PACKAGES_RELEASE.tar.gz”和配置文件“clusterconfig.xml”都上传至上一步所创建的目录中。

3.在安装包所在的目录下,解压安装包。

cd /opt/software/openGauss

tar -zxvf openGauss_x.x.x_PACKAGES_RELEASE.tar.gz

解压后的安装包说明见表1。

表 1 安装包说明

openGauss-x.x.x-openEULER-64bit-ClientTools.tar.gz用于Linux的客户端工具安装包。含gsql、dump restore tool、ODBC驱动、JDBC驱动、Libpq库。

openGauss-x.x.x-openEULER-64bit-Jdbc.tar.gz用于Linux的JDBC驱动安装包。

openGauss-x.x.x-openEULER-64bit-Libpq.tar.gz用于Linux的libpq库。

openGauss-x.x.x-openEULER-64bit-Odbc.tar.gz用于Linux的ODBC驱动安装包。

openGauss-x.x.x-openEULER-64bit-symbol.tar.gz用于调试和定位数据库问题的支持文件。

openGauss-x.x.x-openEULER-64bit.tar.gz数据库管理系统安装包。即本手册使用的安装包。

openGauss-x.x.x-Sslcert.tar.gz用于客户端服务器认证的证书。

openGauss-x.x.x-Inspection.tar.gz用于检查数据库健康状况的巡检工具。

4.对openGauss-x.x.x-openEULER-64bit.tar.gz进行解压。

tar -zxvf openGauss-x.x.x-openEULER-64bit.tar.gz

安装包解压后,会在/opt/software/openGauss路径下自动生成script子目录,并且在script目录下生成gs_preinstall等各种OM工具脚本。说明:

- 在执行前置脚本gs_preinstall时,需要规划好openGauss配置文件路径、安装包存放路径、程序安装目录、实例数据目录,后续普通用户使用过程中不能再更改这些路径。

- 运行前置脚本gs_preinstall准备安装环境时,脚本内部会自动将openGauss配置文件、解压后的安装包同步拷贝到其余服务器的相同目录下。

- 在执行前置或者互信前,请检查/etc/profile文件中是否包含错误输出信息,如果存在错误输出,需手动处理。

5.进入到工具脚本存放目录下。

cd /opt/software/openGauss/script

6.如果是openEuler的操作系统,执行如下命令打开performance.sh文件,用#注释sysctl -w vm.min_free_kbytes=112640 &> /dev/null,键入“ESC”键进入指令模式,执行:wq保存并退出修改。

vi /etc/profile.d/performance.sh

7.为确保openssl版本正确,执行预安装前请加载安装包中lib库。执行命令如下,其中_{packagePath}_为用户安装包放置的路径,本示例中为/opt/software/openGauss。

export LD_LIBRARY_PATH={packagePath}/script/gspylib/clib:$LD_LIBRARY_PATH

8.为确保成功安装,检查 hostname 与 /etc/hostname 是否一致。预安装过程中,会对hostname进行检查。

9.使用gs_preinstall准备好安装环境。若为共用环境需加入–sep-env-file=ENVFILE参数分离环境变量避免与其他用户相互影响,ENVFILE为用户自行指定的环境变量分离文件的路径。

·采用交互模式执行前置,并在执行过程中自动创建root用户互信和openGauss用户互信:

./gs_preinstall -U omm -G dbgrp -X /opt/software/openGauss/clusterconfig.xml

omm为数据库管理员(也是运行openGauss的操作系统用户),dbgrp为运行openGauss的操作系统用户的群组名称,/opt/software/openGauss/clusterconfig.xml为openGauss配置文件路径。在执行过程中,用户根据提示选择是否创建互信,并输入root用户或openGauss用户的密码。

·不允许创建root用户互信时,创建omm用户,在各主机上执行本地模式前置,然后用户手动创建openGauss用户互信:如果预安装指定-L参数,预安装前需手动将所有节点的主机名和ip映射关系,写入各个主机的/etc/hosts,并在每个映射关系后边加入注释内容:#Gauss OM IP Hosts Mapping。

1.执行下面命令准备安装环境。

cd /opt/software/openGauss/script

./gs_preinstall -U omm -G dbgrp -L -X /opt/software/openGauss/clusterconfig.xml

说明:

此操作需要在每台主机上执行该命令。

·采用非交互模式执行前置:

1.参考手工建立互信章节手工建立root用户互信和openGauss用户互信。

2.执行下面命令准备安装环境。

cd /opt/software/openGauss/script

./gs_preinstall -U omm -G dbgrp -X /opt/software/openGauss/clusterconfig.xml --non-interactive

说明:

- 此模式要求用户确保在执行前,已经建立了各节点root用户互信和openGauss用户互信。

- root用户互信可能会存在安全隐患,因此建议用户在执行完安装后,立即删除各主机上root用户的互信。

示例

执行前置脚本:

plat1:/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.

Are you sure you want to create trust for root (yes/no)? yes

Please enter password for root.

Password:

Creating SSH trust for the root permission user.

Checking network information.

All nodes in the network are Normal.

Successfully checked network information.

Creating SSH trust.

Creating the local key file.

Successfully created the local key files.

Appending local ID to authorized_keys.

Successfully appended local ID to authorized_keys.

Updating the known_hosts file.

Successfully updated the known_hosts file.

Appending authorized_key on the remote node.

Successfully appended authorized_key on all remote node.

Checking common authentication file content.

Successfully checked common authentication content.

Distributing SSH trust file to all node.

Successfully distributed SSH trust file to all node.

Verifying SSH trust on all hosts.

Successfully verified SSH trust on all hosts.

Successfully created SSH trust.

Successfully created SSH trust for the root permission user.

Setting pssh path

Successfully set core path.

Distributing package.

Begin to distribute package to tool path.

Successfully distribute package to tool path.

Begin to distribute package to package path.

Successfully distribute package to package path.

Successfully distributed package.

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.

Installing the tools in the cluster.

Successfully installed the tools in the cluster.

Checking hostname mapping.

Successfully checked hostname mapping.

Creating SSH trust for [omm] user.

Checking network information.

All nodes in the network are Normal.

Successfully checked network information.

Creating SSH trust.

Creating the local key file.

Successfully created the local key files.

Appending local ID to authorized_keys.

Successfully appended local ID to authorized_keys.

Updating the known_hosts file.

Successfully updated the known_hosts file.

Appending authorized_key on the remote node.

Successfully appended authorized_key on all remote node.

Checking common authentication file content.

Successfully checked common authentication content.

Distributing SSH trust file to all node.

Successfully distributed SSH trust file to all node.

Verifying SSH trust on all hosts.

Successfully verified SSH trust on all hosts.

Successfully created SSH trust.

Successfully created SSH trust for [omm] user.

Checking OS software.

Successfully check os software.

Checking OS version.

Successfully checked OS version.

Creating cluster's path.

Successfully created cluster's path.

Setting SCTP service.

Successfully set SCTP service.

Set and check OS parameter.

Setting OS parameters.

Successfully set OS parameters.

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.

Set ARM Optimization.

No need to set ARM Optimization.

Fixing server package owner.

Setting finish flag.

Successfully set finish flag.

Preinstallation succeeded.

S


root密码不一致也不能修改为一致,执行前置脚本本地安装模式:

plat1:/opt/software/openGauss/script # ./gs_preinstall -U omm -G dbgrp -L -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.

Checking OS version.

Successfully checked OS version.

Creating cluster's path.

Successfully created cluster's path.

Setting SCTP service.

Successfully set SCTP service.

Set and check OS parameter.

Setting OS parameters.

Successfully set OS parameters.

Warning: Installation environment contains some warning messages.

Please get more details by "/home/package/r8c00/script/gs_checkos -i A -h SIA1000068990".

Set and check OS parameter completed.

Preparing CRON service.

Successfully prepared CRON service.

Preparing SSH service.

Successfully prepared SSH service.

Setting user environmental variables.

Successfully set user environmental variables.

Configuring alarms on the cluster nodes.

Successfully configured alarms on the cluster nodes.

Setting the dynamic link library.

Successfully set the dynamic link library.

Setting Cgroup.

Successfully set Cgroup.

Setting finish flag.

Successfully set finish flag.

Preinstallation succeeded.


以非交互模式执行前置:

plat1:/opt/software/openGauss/script # ./gs_preinstall -U omm -G dbgrp -X /opt/software/openGauss/clusterconfig.xml --non-interactive

Parsing the configuration file.

Successfully parsed the configuration file.

Installing the tools on the local node.

Successfully installed the tools on the local node.

Distributing package.

Begin to distribute package to tool path.

Successfully distribute package to tool path.

Begin to distribute package to package path.

Successfully distribute package to package path.

Successfully distributed package.

Installing the tools in the cluster.

Successfully installed the tools in the cluster.

Checking hostname mapping.

Successfully checked hostname mapping.

Checking OS version.

Successfully checked OS version.

Creating cluster's path.

Successfully created cluster's path.

Setting SCTP service.

Successfully set SCTP service.

Set and check OS parameter.

Setting OS parameters.

Successfully set OS parameters.

Set and check OS parameter completed.

Preparing CRON service.

Successfully prepared CRON service.

Preparing SSH service.

Successfully prepared SSH service.

Setting user environmental variables.

Successfully set user environmental variables.

Configuring alarms on the cluster nodes.

Successfully configured alarms on the cluster nodes.

Setting the dynamic link library.

Successfully set the dynamic link library.

Setting Cgroup.

Successfully set Cgroup.

Set ARM Optimization.

Successfully set ARM Optimization.

Setting finish flag.

Successfully set finish flag.

Preinstallation succeeded.


错误排查

如果准备安装环境失败请根据openGauss日志目录“$GAUSSLOG/om”下的“gs_preinstall-YYYY-MM-DD_HHMMSS.log”和“gs_local-YYYY-MM-DD_HHMMSS.log”中的日志信息排查错误。例如配置文件中“gaussdbLogPath”参数指定的路径为“/var/log/gaussdb”,则“$GAUSSLOG/om”路径为“/var/log/gaussdb/omm/om”,omm用户为运行openGauss的用户。

须知:

准备安装用户及环境的过程中会使用root添加定时任务用于定时巡检和上报。

版权所有@北京神脑资讯技术有限公司(CUUG,中国UNIX用户协会) Copyright ALL Rights Reserved 京ICP备11008061号-1

CUUG旗下网站:www.cuug.com.cn www.cuug.com oracle.cuug.com bbs.cuug.com www.cuug.net

电话:010-59426307 010-59426319 邮政编码:100089

地址:北京市海淀区北清路164号28-38号院