使用pdbcli failover
手动进行集群故障转移。
集群故障转移相关的命令如下:
查询可进行手动故障转移的所有Standby节点:
pdbcli failover --list
返回示例如下:
Using config file: ./config.yaml Cluster Status: { "phase": "RunningPhase", "master": { "endpoint": "10.XX.XX.1:1521", "phase": "RUNNING", "start_at": "2020-09-24 23:32:07", "sync_status": "SYNC" }, "standby": [ { "endpoint": "10.XX.XX.2:1521", "phase": "RUNNING", "start_at": "2020-09-24 23:32:10", "sync_status": "SYNC" }, { "endpoint": "10.XX.XX.3:1521", "phase": "RUNNING", "start_at": "2020-09-24 23:32:10", "sync_status": "SYNC" } ] } Available Candidates: # 可进行手动故障转移的所有standby节点 IP Address 10.XX.XX.2 10.XX.XX.3
当故障发生时,执行以下命令手动转移至某个Standby节点:
pdbcli failover --target '目标Standby节点IP地址'
例如,手动转移至IP为10.XX.XX.2的节点:
pdbcli failover --target 10.XX.XX.2
您可执行pdbcli help failover
或pdbcli failover --help
获取故障转移相关使用说明:
Using config file: ./config.yaml
Perform PolarDB Cluster manual failover.
For example:
pdbcli failover --target 10.XX.XX.2
Usage:
pdbcli failover [flags]
Flags:
-h, --help help for failover # 获取关于failover命令的帮助信息
--list Prints the list of failover candidates. # 展示可进行手动故障转移的所有standby节点
--no-prompt No command line confirmation. # 增加此flag后,不会有命令行的确认信息,请谨慎使用
--target string The standby target IP-ADDRESS which the failover will occur on. (REQUIRED if more than one standby host) #若Standby节点超过一个,则指定进行故障转移目标的Standby节点的IP地址
Global Flags:
--config string Specify Config file. (default "./config.yaml") # 指定配置文件,默认为./config.yaml
--debug Enable additional output for debugging. # 显示更多输出信息,用于调试
该文章对您有帮助吗?