跳转至

seabox set

seabox set

设置数据的物理节点和组件的状态。

分布式数据库在长期运行的过程中,物理服务器会发生故障,但是还没有到无法运行的程度,可能会由于磁盘故障等原因,运行慢一些,使数据库的整体性能下降。为了减少这些情况对数据库造成的影响,在运维人员发现有物理节点或者组件异常时,可以手动设置节点或组件的状态,使数据库处于正常运行状态。

功能说明
  • 如果某个物理节点无法通过 ssh 连接,可以执行: seabox set -n <hostname> -s offline,此物理节点上的 executor 和 coordinator 都会停止服务。需要注意的是,如果此物理节点上有 scdcs 服务,必须先移除 scdcs 服务,再设置其状态为 offline,移除 scdcs 服务:seabox set --remove-host-scdcs-member <hostname>
  • 支持手动将某个 coordinator/executor 其状态设置为 removed,触发 monitor 对其进行自动修复
  • 对于集中式数据库集群,可以手动对 executor 进行主从切换
  • 支持在某个物理节点上对 scdcs 服务进行移除和添加操作
命令格式
seabox set [OPTIONS]

Options:
  -n, --node TEXT                 the node will be set status
  -d, --dbid TEXT                 manual set specified coordinator or executor
                                  status
  -s, --status [online|offline|removed]
                                  the status will be set
  -r, --role [primary]            the role will be set primary
  -t, --ssh-timeout TEXT          ssh timeout, unit:second, default is 120

  --ssh-blocked                   set server offline because ssh cannot
                                  connect to server
  --remove-host-scdcs-member TEXT
                                  remove the scdcs member on this host
  --add-scdcs-member              add an scdcs member to scdcs cluster
  --scdcs-address TEXT            the address of new scdcs member, must be set
                                  with --add-scdcs-member
  --scdcs-datadir TEXT            the datadir of new scdcs member,  must be
                                  set with --add-scdcs-member
  --scdcs-hostname TEXT           the hostname of new scdcs member, must be
                                  set with --add-scdcs-member
  --scdcs-inner-port TEXT         the inner_port of new scdcs member, must be
                                  set with --add-scdcs-member
  --scdcs-service-port TEXT       the service_port of new scdcs member, must
                                  be set with --add-scdcs-member
  -h, --help                      show this help, then exit
参数说明
Options

命令支持的选项

-n, --node
使用该选项时表示设置节点状态,后面跟指定的节点名称
-d, --dbid
使用该选项时表示设置coordinator或executor实例状态,后面跟指定实例的dbid
-s, --status
使用该选项时表示状态,后面跟指定的状态
online: 将已经下线的物理节点上线,仅适用于物理节点
offline: 将运行中的物理节点下线,仅适用于物理节点
removed: 将运行中的组件设置为 removed,仅适用于 coordinator 和 executor
-r, --role
手动对集中式集群的executor进行主从切换,后面参数目前只能是 primary,仅适用于集中式集群
-t, --ssh-timeout
ssh超时时间,单位:秒,默认值为120秒
--ssh-blocked
由于ssh无法连接到服务器,将服务设置为offline
--remove-host-scdcs-member
删除物理节点上的 scdcs 服务,后面跟物理节点的 hostname
--add-scdcs-member
在 scdcs 集群中添加一个 scdcs 服务
--scdcs-address
新添加的 scdcs 服务所在节点的 IP 地址,必须跟 --add-scdcs-member 配合使用
--scdcs-datadir
新添加的 scdcs 服务所在节点的数据目录,必须跟 --add-scdcs-member 配合使用
--scdcs-hostname
新添加的 scdcs 服务的所在节点的 hostname,必须跟 --add-scdcs-member 配合使用
--scdcs-inner-port
新添加的 scdcs 服务的内部通讯端口,必须跟 --add-scdcs-member 配合使用
--scdcs-service-port
新添加的 scdcs 服务的对外服务端口,必须跟 --add-scdcs-member 配合使用
-h, --help
使用该选项时返回seabox set命令的帮助信息
注解

如有具体的使用限制及注意事项,在这部分列出。

  • 注意: seabox set命令要求使用SeaboxMPP数据库集群安装用户seabox,或root用户,且需通过以下命令设置正确的环境变量:
source $SDHOME/seaboxmpp_path.sh

其中,$SDHOME为安装SeaboxMPP数据库服务的主目录。

使用方法
  1. node1 节点状态设置为 offline。可以通过 seabox status -an node1 查看其上的 executor/coordinator,都会变为 removed

    seabox set -n node1 -s offline
    

  2. node1 节点状态设置为 online。可以通过 seabox status -an node1 查看其上的 executor/coordinator,都会变为 normal

    seabox set -n node1 -s online
    

  3. dbid 为 3 的 executor 设置为 removed。 monitor 会在后台对其进行修复,修复完成后,其状态会自动变为 normal

    seabox set -d 3 -s removed
    

  4. node1 上的 scdcs 服务移除

    seabox set --remove-host-scdcs-member node1
    

  5. node3 上添加 scdcs 服务,数据目录为 /home/seabox/data/scdcs,IP地址为 10.10.0.10,内部通讯端口为 5588,对外服务端口为 8855。添加完成后,使用 seabox status -am scdcs 可以看到新添加的 scdcs 服务

    seabox set --add-scdcs-member --scdcs-address 10.10.0.10 --scdcs-datadir /home/seabox/data/scdcs --scdcs-hostname node3 --scdcs-inner-port 5588 --scdcs-service-port 8855
    

  6. 对于集中式集群,将 dbid 为 2 的 executor 切换为主 executor。之前的主 executor 会自动降级为备 executor。使用 seabox status -am executor 可以看到这个变化

    seabox set -d 2 -r primary
    

相关命令