暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

华为GaussDB A gs_loadbalance

墨天轮 2019-10-12
1355

gs_loadbalance

背景信息

gs_loadbalance是GaussDB 200提供的用来负载均衡安装的工具。

说明:
  • keepalived不支持断网线和ifdown网卡场景。若出现网卡ifdown掉或者网线没插好,等主机恢复后重启主机keepalived服务,执行如下命令:
    sh /etc/init.d/gs_keepalived start
  • 若出现主机故障,备机不接管业务的问题。停掉主机所有的keepalived进程,备机将接管业务,执行如下命令:
    sh /etc/init.d/gs_keepalived stop

语法

  • 负载均衡安装
    gs_loadbalance -t install -U user -X xmlfile --master=masterNode [--standby=slaveNode] --lvs-addr=ipaddr [-l logFile]
  • 负载均衡卸载
    gs_loadbalance -t uninstall -U user -X xmlfile [-l logFile]
  • 负载均衡重载
    gs_loadbalance -t reload -U user -X xmlfile --lvs-addr=ipaddr [-l logFile]
  • 显示帮助信息
    gs_loadbalance -? | --help

参数说明

gs_loadbalance参数说明如下:

-t参数取值范围:install,reload,uninstall

其余参数的详细信息请参见表1。

表1 参数说明

参数名

参数说明

-U

运行集群的操作系统用户名,必选参数。

-X

集群配置文件,必选参数。

--lvs-addr

要求用户指定一个未使用的虚拟IP地址,install与reload必选参数。

安装LVS时,master节点上自动虚拟出该IP,如果master节点损坏则该IP自动配置到standby节点(此为keepalived工具自带功能)。

在CN上,需要在lo网卡上绑定此虚拟IP地址。

--master

指定安装LVS主服务器的名称,安装时为必选参数。

--standby

指定安装LVS备服务器的名称,安装时为可选参数。

-l

指定日志文件路径,可选参数。如果不指定,则保存到默认路径,默认值为mpp/用户名/om/gs_loadbalance.log。

--help | -?

显示help帮助信息。

操作步骤

  • 安装负载均衡
  • 以root或者sid为0的用户身份登录服务器,在集群所有节点执行负载均衡安装操作。
  • 执行gs_loadbalance,安装负载均衡组件。

    gs_loadbalance -t install -U omm -X ${BIGDATA_HOME}/FusionInsight_MPPDB_6.5.1/*_*_MPPDBServer/etc/mppdb-install-config.xml --master=masterNode --lvs-addr=ipaddr

  • 检查安装过程是否成功。在集群所有节点均执行安装完毕后,需要在LVS主节点上执行ipvsadm -Ln。

    ipvsadm -Ln

    执行上述命令后,如果出现如下屏显信息,则安装成功。

    ipvsadm: /lib64/libpopt.so.0: no version information available (required by ipvsadm) IP Virtual Server version 1.2.1 (size=4096) Prot LocalAddress:Port Scheduler Flags -> RemoteAddress:Port Forward Weight ActiveConn InActConn FWM 1 -> 10.119.48.104:38041 Local 1 0 0 -> 10.119.50.179:38041 Route 1 0 0

  • 输入命令,查看ipvs模块加载是否成功。

    lsmod | grep ip_vs
    ip_vs_wrr 2281 0 ip_vs_wlc 1279 0 ip_vs_sh 2051 0 ip_vs_sed 1247 0 ip_vs_rr 1426 1 ip_vs_nq 1244 0 ip_vs_lc 1180 0 ip_vs_lblcr 5693 0 ip_vs_lblc 4289 0 ip_vs_ftp 3776 0 ip_vs_dh 1955 0 ip_vs 112149 23 ip_vs_wrr,ip_vs_wlc,ip_vs_sh,ip_vs_sed,ip_vs_rr,ip_vs_nq,ip_vs_lc,ip_vs_lblcr,ip_vs_lblc,ip_vs_ftp,ip_vs_dh ipv6 323245 324 ip_vs,sctp
    安装成功示例打屏日志信息
    No virtual ip address on local host. Begin to install load balance component... compareAndCheckVirtualIp ... Begin to check virtual IP... Virtual ip check succeed. Begin to install LVS component... The configuration file of LVS has been configure succeed. Succeed to restart /etc/init.d/gs_keepalived service. Virtual ip joined the listen_addresses successfully. Reload listen_address succeed. The 'gs_vip' file of CN configure succeed. Installed coordinator node files of load balance component successfully . Installed load balance component successfully .

  • 重载负载均衡
  • 以root或者sid为0的用户身份登录服务器,在集群所有节点执行负载均衡重载操作。
  • 执行gs_loadbalance重载负载均衡配置。

    gs_loadbalance -t reload -U omm -X ${BIGDATA_HOME}/FusionInsight_MPPDB_6.5.1/xx_xx_MPPDBServer/etc/mppdb-install-config.xml --lvs-addr=ipaddr
    reload成功示例打屏日志信息。
    Get old virtual ip from lo:0 successfully. Begin to reload load balance component... Check virtual ip address... Begin to check virtual IP... Virtual ip check successfully. Reload mode check node state successfully. Begin to configure LVS keepalived... The configuration file of LVS has been configure succeessfully. Restart /etc/init.d/gs_keepalived service successfully. Successfully reloaded load balance components.

  • 卸载负载均衡
  • 以root或者sid为0的用户身份登录服务器,在集群所有节点执行负载均衡卸载操作。
  • 执行gs_loadbalance卸载LVS组件。

    ./gs_loadbalance -t uninstall -U omm -X ${BIGDATA_HOME}/FusionInsight_MPPDB_6.5.1/xx_xx_MPPDBServer/etc/mppdb-install-config.xml
    卸载成功示例打屏日志信息
    Get old virtual ip succeed from lo:0. Begin to uninstall load balance component... Begin to uninstall LVS component... Check whether service gs_keepalived exists on local host. Uninstall load balance component successfully. Clear the virtual ip in list of listen address succeed. Uninstalled load balance component successfully.


查看更多:华为GaussDB 200 服务端工具
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论