gs_preinstall
背景信息
Vastbase提供了gs_preinstall工具来帮助完成Vastbase的环境配置,以保证Vastbase安装的正常进行。
注意事项
- 用户需要检查上层目录权限,保证安装用户对安装包和配置文件目录读写执行的权限。
- xml文件中各主机的名称与IP映射配置正确。
- 只能使用root用户执行gs_preinstall命令。
- 执行gs_preinstall会清理/etc/hosts中的Vastbase映射信息,可能存在已部署数据库连接丢失风险,可以在安装结束后手动添加其它数据库映射至/etc/hosts文件中。
- gs_preinstall指定的用户不支持使用-d手动选定家目录,仅支持系统默认创建的/home下和用户同名的/home目录。
本产品支持同一操作系统大版本下的小版本混合部署,其支持列表如下:
CentOS 6.4/6.5/6.6/6.7/6.8/6.9 CentOS 7.0/7.1/7.2/7.3/7.4 openEuler
语法格式
准备Vastbase环境
gs_preinstall -U USER -G GROUP -X XMLFILE [-L] [--skip-os-set] [--env-var="ENVVAR" [...]] [--sep-env-file=MPPRCFILE] [--skip-hostname-set] [-l LOGFILE] [--non-interactive]
显示帮助信息
gs_preinstall -? | --help
显示版本号信息
gs_preinstall -V | --version
参数说明
-U
运行Vastbase的操作系统用户名。
取值范围:字符串,要符合标识符的命名规范。
配置-U参数值时,字符串中不能包含 | 、; 、& 、$ 、< 、> 、`、' 、\ 、{ 、} 、( 、) 、[ 、] 、~ 、* 、? 特殊字符。
-G
运行Vastbase的操作系统用户的群组名。
取值范围:字符串,要符合标识符的命名规范。
-X
Vastbase配置文件路径。
取值范围:xml文件的存储路径。
-L
指定该参数则仅给当前节点准备好Vastbase安装环境。适用于不允许使用root互信的场景和设置安全加固参数PermitRootLogin为no的场景。需要满足如下前提条件:
(1)安装包和Vastbase配置文件已提前上传到所有主机;
(2)Vastbase安装用户已提前创建好并建立好互信关系;
(3)用户需要自己保证各台主机上所执行命令的一致性;
(4)手动将所有节点的主机名和ip映射关系写入各个主机的/etc/hosts,并在每个映射关系后边加入注释内容:
#Gauss OM IP Hosts Mapping
。--skip-os-set
是否设置操作系统参数。默认设置系统参数。如果指定该参数则不设置。
--env-var=“ENVVAR”
配置普通用户环境变量。可以指定多个。
取值范围:字符串。
本参数不能指定为Vastbase默认创建的环境变量。否则,Vastbase的环境变量将被覆盖。Vastbase默认创建的环境变量见表1。
--sep-env-file=MPPRCFILE
保存环境变量的文件。如果指定该参数,表示将使用环境变量分离的版本。
不能指定环境变量文件为Vastbase相关目录或者和这些目录同名,不能和Vastbase用户的目录相同。
--skip-hostname-set
是否将xml配置文件中主机名与IP的映射关系写入“/etc/hosts”文件中。默认写入,如果指定该参数则不写入。
--unused-third-party
是否使用om提供的三方库。默认使用,如果指定该参数则不使用。
-l
指定日志文件名及路径。在内部会自动给日志名添加一个时间戳。
默认值:/var/log/gaussdb/用户名/om/gs_preinstall.log
当不明确指定-l,但在XML文件中配置了gaussdbLogPath时,默认值为gaussdbLogPath的值、用户名和om/gs_preinstall-YYYY-MM-DD_hhmmss.log的组合。
--non-interactive
指定前置执行模式。
- 当不指定该参数时,则为安全交互模式,在此模式下用户需要人机交互输入密码。
- 当指定该参数时,为非交互模式,不需要进行人机交互。
-?, --help
显示帮助信息。
-V, --version
显示版本号信息。
手动设置服务端SYSLOG配置
设置“/etc/syslog-ng/syslog-ng.conf”文件,在文件中添加如下内容:
template t_gaussdb {template("$DATE $SOURCEIP $MSGONLY\n");template_escape(no);};
source s_gaussdb{ udp(); };
filter f_gaussdb { level(err, crit) and match('GaussDB'); };
destination d_gaussdb { file("/var/log/syslog_MPPDB", template(t_gaussdb)); };
log { source(s_gaussdb); filter(f_gaussdb); destination(d_gaussdb); };
设置“/etc/sysconfig/syslog”文件,在文件中添加如下内容:
SYSLOGD_OPTIONS="-r -m 0"
KLOGD_OPTIONS="-x"
该配置需要在Vastbase每台机器上都要修改。
示例
使用非交互方式进行Vastbase环境准备:
./gs_preinstall -U omm -G dbgrp -X /opt/software/vastbase/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.
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.
Set and check OS parameter.
Setting OS parameters.
Successfully set OS parameters.
Warning: InstallationGuide environment contains some warning messages.
Please get more details by "/package_r8/sudo/gs_checkos -i A -h host179174,host179175,host179176".
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 finish flag.
Successfully set finish flag.
PreInstallationGuide succeeded.
使用交互模式进行Vastbase环境准备:
./gs_preinstall -U omm -G dbgrp -X /opt/software/vastbase/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.
Please enter password for current user[root].
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 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
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.
Set and check OS parameter.
Setting OS parameters.
Successfully set OS parameters.
Warning: InstallationGuide environment contains some warning messages.
Please get more details by "/package_r8/sudo/gs_checkos -i A -h host179174,host179175,host179176".
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 finish flag.
Successfully set finish flag.
PreInstallationGuide succeeded.
常见问题
GAUSS-53700: “Failed to execute the command: %s.”
错误原因: 这是由于OpenSSL的随机数生成器没有正常工作导致的。这可能是因为系统缺少足够的熵,或者 OpenSSL 的配置有问题。 以下是常用的检查项。
解决办法:
1、增加系统熵池:如果系统缺少足够的熵,可以通过增加系统活动来增加熵池的随机性。例如,可以打开几个终端窗口并执行一些随机的操作,如移动鼠标、键盘输入等。
2、检查 OpenSSL 配置:确保 OpenSSL 的配置正确,可以检查 OpenSSL 的配置文件和环境变量,确保它们指向正确的路径和文件。
3、更新 OpenSSL 版本:如果 OpenSSL 版本较旧,可能会存在一些已知的问题和 bug。尝试更新到最新的稳定版本。
4、检查文件权限:确保正在生成证书的目录和文件具有足够的权限,以便 OpenSSL 可以在其中生成证书。
5、使用其他随机数生成器:如果以上方法都没有解决问题,可以尝试使用其他的随机数生成器替代 OpenSSL 默认的随机数生成器。