更新时间:2026-11-03 GMT+08:00
分享

集群管理

集群管理提供基于DWS OpenAPI的集群信息只读查询能力,覆盖集群、参数组、审计、数据源、负载、扩缩容、逻辑集群、升级、SQL防误操作、事件、告警、备份容灾等15个类别共77条端点。

使用场景: AI Agent可通过集群管理命令获取集群运行状态、资源配置、审计日志等信息,用于智能诊断、运维巡检和容量规划。所有命令均为只读查询,不会修改集群配置。

集群 ID 自动从 config 注入,可用 --cluster-id 覆盖;--dry-run 输出 endpoint / method / path / params 预览而不发起调用。

表1 集群管理命令

子命令组

命令

cluster list

clusters(--api-version v1\|v2,默认 v2,--limit/--offset 分页)、statistics

cluster show

info、node-types、flavor、elbs、cns、instances、endpoints、volume、encrypt-info、actions <action_name>、instance <instance_id>、nodes、topo-rings、topology、resource-statistics

# 集群列表(v2 API 默认)
hwc-dws-cli cluster list clusters --format table 
hwc-dws-cli cluster list clusters --api-version v1 --limit 50 --offset 0 
hwc-dws-cli cluster list statistics  

# 集群详情 / 规格 / 节点
hwc-dws-cli cluster show info --cluster-id xxx-xxx-xxx 
hwc-dws-cli cluster show node-types 
hwc-dws-cli cluster show flavor 
hwc-dws-cli cluster show nodes 
hwc-dws-cli cluster show topology  

# 含路径参数的查询
hwc-dws-cli cluster show actions restart 
hwc-dws-cli cluster show instance 5f9c9f0e-xxxx-xxxx  

# 预览 API 调用(不实际执行)
hwc-dws-cli cluster show info --dry-run 

表2 参数组、审计与数据源

子命令组

命令

cluster configurations

list、show <configuration_id>、audit-records、security <configuration_id>

cluster audit

log-records

cluster datasource

list

hwc-dws-cli cluster configurations list 
hwc-dws-cli cluster configurations show 8c2b5f1e-xxxx 
hwc-dws-cli cluster configurations audit-records 
hwc-dws-cli cluster configurations security 8c2b5f1e-xxxx 
hwc-dws-cli cluster audit log-records 
hwc-dws-cli cluster datasource list 

表3 工作负载与资源池

子命令

命令

cluster workload

status、queue-jobs、rules

cluster workload plans

list、show <plan_id>、logs <plan_id>、stage <plan_id> <stage_id>

cluster workload pools

list、show <pool_id>(--pool-name 可用名称替代)、users <pool_name>、plans <pool_name>

# 工作负载
hwc-dws-cli cluster workload status 
hwc-dws-cli cluster workload queue-jobs 
hwc-dws-cli cluster workload rules  

# 负载计划
hwc-dws-cli cluster workload plans list 
hwc-dws-cli cluster workload plans show my_plan 
hwc-dws-cli cluster workload plans logs my_plan 
hwc-dws-cli cluster workload plans stage my_plan stage_1  

# 资源池
hwc-dws-cli cluster workload pools list 
hwc-dws-cli cluster workload pools show my_pool 
hwc-dws-cli cluster workload pools users my_pool 
hwc-dws-cli cluster workload pools plans my_pool 

表4 扩缩容、逻辑集群、升级、事件告警

子命令组

命令

cluster scale-out

redistribution、redistribution-schemas

cluster scale-up

storage-expand-range

cluster vw

list、tasks、volumes、rings、plans

cluster upgrade

avail-versions、records

cluster sql-block

rules <database>

cluster auto-vacuumfull

list、detail <task_id>、configuration

cluster event

subs、specs、list

cluster alarm

subs、list、statistic、configs

# 扩容重分布
hwc-dws-cli cluster scale-out redistribution 
hwc-dws-cli cluster scale-out redistribution-schemas  

# 磁盘扩容范围
hwc-dws-cli cluster scale-up storage-expand-range  

# 逻辑集群(vw)
hwc-dws-cli cluster vw list 
hwc-dws-cli cluster vw tasks 
hwc-dws-cli cluster vw volumes  

# 升级
hwc-dws-cli cluster upgrade avail-versions 
hwc-dws-cli cluster upgrade records  

# SQL 防误操作拦截
hwc-dws-cli cluster sql-block rules postgres  

# 自动 vacuum full
hwc-dws-cli cluster auto-vacuumfull list 
hwc-dws-cli cluster auto-vacuumfull detail <task_id> 
hwc-dws-cli cluster auto-vacuumfull configuration  

# 事件 / 告警
hwc-dws-cli cluster event list 
hwc-dws-cli cluster event subs 
hwc-dws-cli cluster alarm list 
hwc-dws-cli cluster alarm statistic 

表5 备份容灾

子命令

命令

cluster backup-dr

snapshots、snapshot <snapshot_id>、snapshot-statistics、cluster-snapshots、snapshot-policies、snapshot-policy <policy_id>、snapshot-policy-plan、cross-region-snapshot-policies、check-name <name>、roach-configs、databases、database-schemas <database>、cross-regions、cross-region-policies、backup-files <snapshot_id>、disaster-recoveries、disaster-recovery <id>、disaster-recovery-clusters、restore-schemas <snapshot_id> <database>、disaster-recovery-progress <id>

# 快照
hwc-dws-cli cluster backup-dr snapshots 
 
# 名称检查 / 数据库与 schema
hwc-dws-cli cluster backup-dr check-name my-snapshot 
hwc-dws-cli cluster backup-dr databases 
hwc-dws-cli cluster backup-dr database-schemas postgres  

# 跨区域策略 / 容灾
hwc-dws-cli cluster backup-dr cross-region-snapshot-policies 
hwc-dws-cli cluster backup-dr cross-regions 
hwc-dws-cli cluster backup-dr cross-region-policies 
hwc-dws-cli cluster backup-dr disaster-recoveries 
hwc-dws-cli cluster backup-dr disaster-recovery <id> 
hwc-dws-cli cluster backup-dr disaster-recovery-clusters 
hwc-dws-cli cluster backup-dr disaster-recovery-progress <id>  

# 按快照恢复 schema
hwc-dws-cli cluster backup-dr restore-schemas <snapshot_id> postgres

相关文档