seabox replace
seabox replace¶
分布式数据库节点替换功能。分布式数据库每个 executor 至少有1个备用 executor,当主 executor 发生故障时,备 executor 会切换为主 executor 继续服务,使用户的业务不会中断,此时数据库的高可用机制会对故障的 executor 进行修复。
如果物理节点故障损坏,故障的 executor 也无法进行修复了,此时对应的 executor 很可能会单副本运行,再发生故障,就可能丢失数据。此时可以使用新的物理节点替换故障的物理节点,以恢复数据库的高可用性,确保用户的数据安全。
功能说明¶
- 在进行节点替换前,需确保目标节点已经在集群中,如果还没有添加进集群,则需要使用
seabox install host -h <hostname>
添加进集群 - 目标节点的状态必须为
normal
,否则无法进行节点替换 - 目标节点上不能有任何 coordinator/executor/monitor 等组件的存在,否则无法进行节点替换
- 在进行节点替换前,如果原节点状态为
normal
或者down
,需要使用seabox set -n <hostname> -s offline
将其下线,否则无法进行节点替换 monitor_enable_exec_basebackup
和monitor_enable_coor_basebackup
必须设置为1,否则无法进行节点替换- 节点替换操作返回后,会在后台自动地进行 coordinator/executor/monitor 的重建,当数据量较大时,此工作会持续较长的时间,需要用户耐心等待一下,此时通过
seabox status -a
可以看到新的物理节点上的组件状态为removed
,这是正常情况,不需要人工干预,当组件重建完成后,其状态会自动变为normal
命令格式¶
seabox replace [OPTIONS]
Options:
-n, --dest-host TEXT the module will relocate to this host
-s, --src-host TEXT the module on this host will be relocated to dest_host
--skip-confirm skip the confirm message
-v, --verbose debug output
-h, --help show this help and exit
参数说明¶
- Options
-
命令支持的选项
-n, --dest-host
- 目标节点的 hostname,原节点上的组件,将会被迁移到此节点上
-s, --src-host
- 被替换节点的 hostname
--skip-confirm
- 跳过确认信息。默认值为 False
- 在进行节点替换前,会提示用户是否进行替换,此参数设置后,将直接进行迁移
- 如果目标节点中的数据目录非空,会提示用户是否清空数据目录,此参数设置后,将直接清空数据目录
-h, --help
- 使用该选项时返回 seabox replace 命令的帮助信息
使用方法¶
-
使用
node3
替换node1
,使用seabox status -a
可以看到node1
上的 coordinator/executor/monitor 都会迁移到node3
上seabox replace -s node1 -n node3
相关命令¶
- 无