ITPub博客

首页 > 数据库 > > 数据库管理工具-gs_preinstall

数据库管理工具-gs_preinstall

作者:GaussDB_数据库 时间:2020-01-10 08:52:22 0 删除 编辑

GaussDB 100提供了gs_preinstall工具来帮助完成集群的环境配置,以保证集群安装的正常进行。

注意事项

  • 检查上层目录权限,保证安装用户对安装包和配置文件目录读写执行的权限。
  • 安装包放置的目录中没有其他用户的文件。
  • 配置文件中各主机的名称与IP映射配置正确。
  • 使用root用户执行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 }
    参数说明
  • -U

    运行集群的操作系统用户名,同时也是数据库管理员用户名。

    取值范围:字符串,要符合标识符的命名规范。

  • -G

    运行集群的操作系统用户的群组名。

    取值范围:字符串,要符合标识符的命名规范。

  • -X

    集群配置文件路径。

    取值范围:clusterconfig.xml的路径。

  • --alarm-type=ALARMTYPE

    告警类型。

    取值范围:1、3。默认值为1。
    • 当--alarm-type=1

      表示使用第三方工具FusionInsight获取告警信息。

    • 当--alarm-type=3

      表示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
      当告警类型为3时,要产生告警,需要确保以下条件:
      • 确保防火墙开启514端口。
      • 确保SELinux服务处于关闭状态。
  • --alarm-server-addr=HOSTADDR

    系统日志服务器端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
  • -L

    指定该参数则仅给当前节点准备好集群安装环境。适用于不允许使用root互信的场景。需要满足如下前提条件:

    • 安装包和集群配置文件已提前上传到所有主机。
    • 集群安装用户已提前创建好并建立好互信关系。
    • 用户需要自己保证各台主机上所执行命令的一致性。
  • --skip-os-set

    是否设置操作系统参数。默认设置系统参数(不包括配置NTP服务)。如果指定该参数则不设置。

  • --env-var="ENVVAR"

    配置普通用户环境变量。可以指定多个。

    取值范围:字符串。

    不能指定集群默认创建的环境变量。默认创建的环境变量见表1。

  • --sep-env-file=MPPRCFILE

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

    • 使用环境变量分离文件时,可以使用不同操作系统用户和不同环境变量分离文件在一组服务器上安装多组集群。
    • 环境变量文件名不能和集群相关目录以及集群用户目录同名。
    • 必须保证集群用户对目录有读、写权限。
  • --skip-hostname-set

    是否将xml配置文件中主机名与IP的映射关系写入“/etc/hosts”文件中。默认写入,如果指定该参数则不写入。

  • -l

    指定日志文件名及路径。在内部会自动给日志名添加一个时间戳。

    默认值:$GAUSSLOG/om/gs_preinstall.log

    • 当既不明确指定-l,又不在XML文件中配置gaussdbLogPath时,默认值为“/var/log/gaussdb/用户名/om/gs_preinstall.log”。
    • 当不明确指定-l,但在XML文件中配置了gaussdbLogPath时,默认值为gaussdbLogPath的值、用户名和om/gs_preinstall.log的组合。
  • --non-interactive

    指定前置执行模式。

    当各个节点的root互信和集群用户互信已经创建,且集群用户已创建好的情况下,才可以在执行前置时使用此参数。

  • --operation

    指定是哪种操作类型的预安装。

    不指定该参数,默认是正常的预安装。

    取值范围:upgrade。在升级的时候,指定该参数,可执行简化的预安装操作,只实现和升级有关的操作,不做全量的预安装准备工作。

  • --set-irq-affi

    设置网卡中断绑核。该参数只支持一体机环境。指定该参数后,预安装会写入自启动任务,当系统启动时会执行特定绑核脚本。

  • --disable-service

    关闭系统服务,该参数只支持一体机环境。指定该参数后,预安装会关闭sysmonitor和irqbalance服务。

  • -?,--help

    显示帮助信息。

  • -V,--version

    显示版本号信息。

    表1 GaussDB 100默认创建的环境变量

    环境变量名称

    说明

    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下。

手动设置服务端SYSLOG配置

  • 当机器的syslog类型为rsyslog时,服务器端的配置方法为:

设置“/etc/rsyslog.conf”文件,在文件中添加如下内容:

$ModLoad imudp
$UDPServerRun 514
$imjournalRatelimitInterval 1
$imjournalRatelimitBurst 50000
local3.* /var/log/syslog_zenith
  • 当机器的syslog类型为syslog-ng时,服务器端的配置方法为:

设置“/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"

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

示例

  • 使用gs_preinstall准备数据库集群的安装环境时,如果返回如下所示告警信息(其中/opt/software/gaussdb/script为工具存放目录),请执行“/opt/software/gaussdb/script/gs_checkos -i A -h plat1,plat2,plat3 -X /opt/software/gaussdb/clusterconfig.xml --detail”(/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".
  • 使用安全交互模式进行集群环境准备:
    1. 如果数据库集群安装用户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.
      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.
    2. 一体机环境,如果数据库集群安装用户omm在当前集群各节点上已存在,那么使用gs_preinstall准备安装环境时不再创建安装用户:
      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/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2020-01-06

  • 博文量
    2907
  • 访问量
    19197