准备安装用户及环境
创建完集群配置文件后,为了后续能以最小权限进行安装及集群管理操作,保证系统安全性,需要运行安装前置脚本gs_preinstall准备好安装用户及环境。
安装前置脚本gs_preinstall主要完成如下的安装环境准备工作:
- 自动设置Linux内核参数以达到提高服务器负载能力的目的。这些参数直接影响数据库系统的运行状态,请仅在确认必要时调整。GaussDB 100所设置的Linux内核参数取值请参见配置操作系统参数。
- 自动将集群配置文件、安装包拷贝到集群各主机的相同目录下。
- 集群安装用户、用户组不存在时,自动创建安装用户以及用户组。
- 读取集群配置文件中的目录信息并创建。将目录权限授予安装用户。
- 自动对集群内主机进行时间同步。
前提条件
- 已完成操作系统预配置的所有任务。
- 用户需确保各个主机上的locale保持一致。
注意事项
- 检查上层目录权限,保证安装用户对安装包和配置文件目录读写执行的权限。
- 安装包放置的目录中没有其他用户的文件。
- 已按准备软件,获取所需安装软件包。
- 使用root用户执行gs_preinstall命令。
操作步骤
- 使用WinSCP工具,以root用户登录待安装集群的任意主机。
- 创建存放软件包的目录“/opt/software/gaussdb”。说明:
请勿将软件包的存放目录规划到GaussDB 100用户的家目录(/home/用户名)或其子目录下,否则可能导致权限问题。
本文均以安装目录为“/opt/software/gaussdb”为例说明。
- 将准备的安装软件包、配置文件“clusterconfig.xml”上传至“/opt/software/gaussdb”目录中。说明:
运行前置脚本gs_preinstall准备安装环境时,脚本内部会自动将集群配置文件、解压后的安装包同步拷贝到其余服务器的相同目录下。
- 使用PuTTY工具,以root帐号登录存放安装软件包的同一主机。
- 解压缩安装软件包(例如软件包为“GaussDB_100_1.0.0-EULER20SP8-ARM.tar.gz”)。
cd /opt/software/gaussdb tar -zxvf GaussDB_100_1.0.0-EULER20SP8-ARM.tar.gz
解压缩后显示类似如下信息(根据安装包的不同软件包名有差异):
[root@plat1 gaussdb]#tar -zxvf GaussDB_100_1.0.0-EULER20SP8-ARM.tar.gz ...... GaussDB_100_1.0.0-CLUSTER-EULER20SP8-64bit.tar.gz GaussDB_100_1.0.0-TOOLS.tar.gz ......
- 解压缩安装脚本文件包。
脚本文件在5解压缩后的“GaussDB_100_1.0.0-CLUSTER-OSName-xxx.tar.gz”文件包中,例如:
tar -zxvf GaussDB_100_1.0.0-CLUSTER-EULER20SP8-64bit.tar.gz
脚本文件包解压后,会在/opt/software/gaussdb路径下自动生成script子目录(工具脚本所在目录)。
- 赋予工具脚本存放目录及其上层文件夹755权限。
需要确保数据库安装用户对工具脚本存放目录具有读取、执行的权限。
chmod 755 /opt/software
- 确认集群各节点root密码一致。当集群各节点密码不一致时,按照以下步骤修改密码。
passwd Changing password for root. New Password: XXXXXXXX Reenter New Password: XXXXXXXX Password changed.
- 进入到工具脚本存放目录。
cd /opt/software/gaussdb/script
- 使用gs_preinstall准备好安装环境。
./gs_preinstall -U omm -G dbgrp -X /opt/software/gaussdb/clusterconfig.xml
其中omm为数据库管理员(也是运行集群的操作系统用户),dbgrp为运行集群的操作系统用户的群组名称,/opt/software/gaussdb/clusterconfig.xml为集群配置文件路径。
- (可选)基于安全考虑,建议执行预安装完成后,将/opt/software目录更改属主为数据库用户,且权限为700。
chown omm.dbgrp /opt/software chmod 700 /opt/software
示例
- 使用gs_preinstall准备数据库集群安装环境的过程中,输入root用户的密码有3次机会,输入安装集群的操作系统用户omm的密码只有1次机会,输错密码超过规定次数则会报相应错误并退出gs_preinstall的执行过程。
- 使用gs_preinstall准备数据库集群的安装环境时,如果返回如下所示告警信息(其中/opt/software/gaussdb/script为工具存放目录),请执行“/opt/software/gaussdb/script/gs_checkos -i A -h plat1,plat2,plat3 -X /opt/software/gaussdb/clusterconfig.xml”(/opt/software/gaussdb为配置文件clusterconfig.xml的存放目录)命令排查告警原因,并对告警项进行修复,避免对数据库集群的安装或安装后的正常使用产生影响。
Warning: Installation environment contains some warning messages. Please get more details by "/opt/software/gaussdb/script/gs_checkos -i A -h plat1,plat2,plat3".
- 使用安全交互模式进行集群环境准备:
- 如果数据库集群安装用户omm在当前集群各节点上不存在,那么使用gs_preinstall准备安装环境时会自动创建安装用户:
plat1:/opt/software/gaussdb/script #./gs_preinstall -U omm -G dbgrp -X /opt/software/gaussdb/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. Pass over configuring LVM Distributing package. 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: Creating [omm] user on all nodes. Successfully created [omm] user on all nodes. 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. Please enter password for current user[omm]. Password: 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 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. Fixing server package owner. Successfully fixed server package owner. Create logrotate service. Successfully create logrotate service. Setting finish flag. Successfully set finish flag. Preinstallation succeeded.
- 如果数据库集群安装用户omm在当前集群各节点上已存在,那么使用gs_preinstall准备安装环境时不再创建安装用户:
plat1:/opt/software/gaussdb/script #./gs_preinstall -U omm -G dbgrp -X /opt/software/gaussdb/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. Distributing package. Successfully distributed package. Are you sure you want to create the user[omm] and create trust for it (yes/no)? yes 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. Please enter password for current user[omm]. Password: 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 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. Fixing server package owner. Successfully fixed server package owner. Create logrotate service. Successfully create logrotate service. Setting finish flag. Successfully set finish flag. Preinstallation succeeded.
- 仅给当前主机准备好集群安装环境:
plat1:/opt/software/gaussdb/script #./gs_preinstall -U omm -G dbgrp -L -X /opt/software/gaussdb/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. 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. Fixing server package owner. Successfully fixed server package owner. Create logrotate service. Successfully create logrotate service. Setting finish flag. Successfully set finish flag. Preinstallation succeeded.
错误排查
如果准备安装环境失败请根据集群日志目录“$GAUSSLOG/om”下的“gs_preinstall-YYYY-MM-DD_HHMMSS.log”和“gs_local-YYYY-MM-DD_HHMMSS.log”中的日志信息排查错误。
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」关注作者【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。评论
- 如果数据库集群安装用户omm在当前集群各节点上已存在,那么使用gs_preinstall准备安装环境时不再创建安装用户:
- 如果数据库集群安装用户omm在当前集群各节点上不存在,那么使用gs_preinstall准备安装环境时会自动创建安装用户:
- 解压缩安装脚本文件包。