首页 > 数据库 > > 数据库管理工具-gs_preinstall
GaussDB 100提供了gs_preinstall工具来帮助完成集群的环境配置,以保证集群安装的正常进行。
gs_preinstall -U USER -G GROUP -X XMLFILE [--alarm-type=ALARMTYPE] [--alarm-server-addr=HOSTADDR] [-L] [--skip-os-set] [--env-var="ENVVAR" [...]] [--sep-env-file=MPPRCFILE] [--skip-hostname-set] [-l LOGFILE] [--non-interactive] [--operation=OPERATION] [--set-irq-affi] [--disable-service]
gs_preinstall { -? | --help }显示版本号信息
gs_preinstall { -V | --version }参数说明
运行集群的操作系统用户名,同时也是数据库管理员用户名。
取值范围:字符串,要符合标识符的命名规范。
运行集群的操作系统用户的群组名。
取值范围:字符串,要符合标识符的命名规范。
集群配置文件路径。
取值范围:clusterconfig.xml的路径。
告警类型。
表示使用第三方工具FusionInsight获取告警信息。
表示alarm是经过了处理的syslog信息。
取值为3时,需要添加--alarm-server-addr参数,参数值为syslog服务端IP地址。
syslog服务端支持主备配置。当有主备服务器时,--alarm-server-addr的值为两个服务器的IP值,两IP之间用逗号隔开,逗号之前为主服务器IP,之后为备服务器IP。如"--alarm-server-addr=10.10.0.11,10.10.0.12",表示10.10.0.11为主服务器IP地址,10.10.0.12为备服务器IP地址。
如果需要配置的服务器不在集群内,需要手动配置服务器syslog环境,主备服务器每台机器上的配置都要修改。设置“/etc/rsyslog.conf”文件,在文件中添加如下内容。
$ModLoad imudp
$UDPServerRun 514
$imjournalRatelimitInterval 1
$imjournalRatelimitBurst 50000
local3.* /var/log/syslog_zenith

系统日志服务器端IP。
当告警类型为3,则必须指定该参数。参数值为syslog服务端IP地址。服务端可支持主备,当有主备服务器时,--alarm-server-addr的值为两个服务器的IP值,两IP之间用逗号隔开,逗号之前为主服务器IP,之后为备服务器IP。如"--alarm-server-addr=10.10.0.11,10.10.0.12",表示10.10.0.11为主服务器IP地址,10.10.0.12为备服务器IP地址。如果需要配置的服务器不在集群内,需要手动配置服务器syslog环境,设置“/etc/rsyslog.conf”文件,在文件中添加如下内容。
$ModLoad imudp
$UDPServerRun 514
$imjournalRatelimitInterval 1
$imjournalRatelimitBurst 50000
local3.* /var/log/syslog_zenith
指定该参数则仅给当前节点准备好集群安装环境。适用于不允许使用root互信的场景。需要满足如下前提条件:
是否设置操作系统参数。默认设置系统参数(不包括配置NTP服务)。如果指定该参数则不设置。
配置普通用户环境变量。可以指定多个。
取值范围:字符串。

不能指定集群默认创建的环境变量。默认创建的环境变量见表1。
MPPRCFILE是环境变量分离文件,用户保存环境变量的文件。如果指定该参数,表示集群中生成的所有环境变量会保存在该文件中,而不再保存在/etc/profile和用户的~/.bashrc文件中。

是否将xml配置文件中主机名与IP的映射关系写入“/etc/hosts”文件中。默认写入,如果指定该参数则不写入。
指定日志文件名及路径。在内部会自动给日志名添加一个时间戳。
默认值:$GAUSSLOG/om/gs_preinstall.log
指定前置执行模式。
当各个节点的root互信和集群用户互信已经创建,且集群用户已创建好的情况下,才可以在执行前置时使用此参数。
指定是哪种操作类型的预安装。
不指定该参数,默认是正常的预安装。
取值范围:upgrade。在升级的时候,指定该参数,可执行简化的预安装操作,只实现和升级有关的操作,不做全量的预安装准备工作。
设置网卡中断绑核。该参数只支持一体机环境。指定该参数后,预安装会写入自启动任务,当系统启动时会执行特定绑核脚本。
关闭系统服务,该参数只支持一体机环境。指定该参数后,预安装会关闭sysmonitor和irqbalance服务。
显示帮助信息。
显示版本号信息。
环境变量名称 | 说明 |
|---|---|
SEPARATE_ENV_FILE | 集群环境变量分离文件路径。该环境变量仅存在于使用环境变量分离文件的集群中。 |
GPHOME | 集群工具目录。 |
PATH | 集群工具脚本目录。 |
LD_LIBRARY_PATH | 集群引用第三方动态库路径。 |
PYTHONPATH | python软件路径。 |
GAUSS_WARNING_TYPE | 告警类型。 |
CM_HOME | cm安装目录。 |
GAUSS_HOME | 数据库安装目录。 |
GAUSSHOME | 数据库安装目录。 |
GSDB_DATA | 该节点上CN的数据目录。 |
GSDB_HOME | 数据库安装目录。 |
ETCD_HOME | ETCD安装目录。 |
ETCD_CERT_SERVER_FILE | ETCD的证书互信文件。 |
ETCD_KEY_SERVER_FILE | ETCD的证书互信文件。 |
ETCD_CA_SERVER_FILE | ETCD的证书互信文件。 |
ETCD_CA_MEMBER_FILE | ETCD的证书互信文件。 |
ETCD_CERT_MEMBER_FILE | ETCD的证书互信文件.。 |
ETCD_KEY_MEMBER_FILE | ETCD的证书互信文件。 |
ETCD_CA_CLIENT_FILE | ETCD的证书互信文件。 |
ETCD_KEY_CLIENT_FILE | ETCD的证书互信文件。 |
ETCD_CERT_CLIENT_FILE | ETCD的证书互信文件。 |
ETCD_UNSUPPORTED_ARCH | 确保ARM_64环境下ETCD可正常工作。仅存在于ARM_64上安装的集群环境中。 |
ETCDCTL_API | ETCDCTL支持的版本。 |
GAUSSTMP | 集群临时文件路径。 |
GS_CLUSTER_NAME | 集群名称。 |
GAUSSLOG | 集群日志路径。 |
ETCD_ADDRESS | 集群访问etcd地址。 |
GAUSS_ENV | 集群安装标识。 |
ROACH_HOME | roach安装目录。 |

GPHOME和PYTHONPATH环境变量配置在root用户的/etc/profile下。
设置“/etc/rsyslog.conf”文件,在文件中添加如下内容:
$ModLoad imudp
$UDPServerRun 514
$imjournalRatelimitInterval 1
$imjournalRatelimitBurst 50000
local3.* /var/log/syslog_zenith
设置“/etc/syslog-ng/syslog-ng.conf”文件,在文件中添加如下内容:
source s_gaussdb{ udp(ip("0.0.0.0") port(514)); };
filter f_gaussdb { level(debug..emerg) and facility(local3); };
destination d_gaussdb { file("/var/log/syslog_zenith"); };
log { source(src); source(s_gaussdb); filter(f_gaussdb); destination(d_gaussdb); };
设置“/etc/sysconfig/syslog”文件,在文件中添加如下内容:
SYSLOGD_OPTIONS="-r -m 0"
KLOGD_OPTIONS="-x"

该配置需要在集群每台机器上都要修改。

Warning: Installation environment contains some warning messages.
Please get more details by "/opt/software/gaussdb/script/gs_checkos -i A -h plat1,plat2,plat3".
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.
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.
Start creating SSH trust for [omm] user.
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.
Clean SSH trust for the root permission user.
Successfully cleaned SSH trust for the root permission user.
Preinstallation succeeded.
plat1:/opt/software/gaussdb/script # ./gs_preinstall -U omm -G dbgrp -X /opt/software/gaussdb/clusterconfig.xml --set-irq-affi --disable-service
Parsing the configuration file.
Successfully parsed the configuration file
Start to check if the data disk mount status is Normal.
Get the ALL_IN_ONE_PRODUCT type[GaussDB T110 V1 or GaussDB T130 V1].
Successfully get the ALL_IN_ONE_PRODUCT type.
Get the current raid disk numbers.
Successfully get the current disk numbers.
Successfully checked the data disk mount status:Normal.
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.
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:
Start creating SSH trust for [omm] user.
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.
Disable system service.
Successfully disable system service.
Set NIC irq affinity.
Successfully set NIC irq affinity.
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.
Clean SSH trust for the root permission user.
Successfully cleaned SSH trust for the root permission user.
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.plat1:/opt/software/gaussdb/script # ./gs_preinstall -U omm -G dbgrp -X /opt/software/gaussdb/clusterconfig.xml --operation=upgrade
Parsing the configuration file.
Successfully parsed the configuration file.
Do preinstall for upgrade.
Check environment for upgrade preinstall.
Successfully check environment for upgrade preinstall.
Installing the tools on the local node.
Successfully installed the tools on the local node.
Creating SSH trust for the root permission user.
Please enter password for root.
Password:
Successfully created SSH trust for the root permission user.
Distributing package.
Successfully distributed package.
Check old environment on all nodes.
Successfully check old environment on all nodes.
Installing the tools in the cluster.
Successfully installed the tools in the cluster.
Fixing server package owner.
Successfully fixed server package owner.
Clean SSH trust for the root permission user.
Successfully cleaned SSH trust for the root permission user.
Preinstallation succeeded.
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/69959250/viewspace-3140629/ ,如需转载,请注明出处,否则将追究法律责任。