Install
openclaw skills install @huaweicloudskill/huawei-cloud-rds-mysql-replica-promotionHuawei Cloud RDS for MySQL risk reduction skill that converts a single instance to a primary/standby (HA) instance via the hcloud CLI. Use this skill when the user wants to convert a Huawei Cloud RDS for MySQL single instance to a primary/standby (HA) instance, upgrade database high availability, or eliminate single-point-of-failure risk. Trigger: User mentions "单机转主备", "高可用升级", "single to HA", "convert to primary/standby"
openclaw skills install @huaweicloudskill/huawei-cloud-rds-mysql-replica-promotionUse the hcloud (KooCLI) command-line tool to convert a Huawei Cloud RDS for MySQL single instance to a primary/standby (HA) instance.
hcloud configure init)Single instance in ACTIVE stateCopy the checklist below and track progress:
- [ ] Step 0: Environment Check
- [ ] Step 1: Instance Discovery and Selection
- [ ] Step 2: Availability Zone Discovery and Selection
- [ ] Step 3: Risk Disclosure
- [ ] Step 4: Precondition Check
- [ ] Step 5: Cost Assessment
- [ ] Step 6: Pre-conversion Monitoring Baseline
- [ ] Step 7: Conversion Confirmation and Execution
- [ ] Step 8: Result Confirmation and Monitoring Comparison
- [ ] Step 9: Workflow Summary
Step 0: Environment Check
Step 1: Instance Discovery and Selection
Single type and ACTIVE status are verified by the read-only pre-check in Step 4; if that check fails, the workflow terminates with the reason.id, name, region, engine, engine_version, flavor_ref, instance_type, node_num, availability_zone, volume_type, volume_size, charge_mode, status, convertible)region, flavor_ref, engine_version, and availability_zone for later stepsStep 2: Availability Zone Discovery and Selection
--region <selected instance region>, --database-name MySQL, --version-name <selected instance engine_version>, --spec-code <selected instance flavor_ref>, and --instance-id <selected instance id>
az_code, az_name, az_status, available, is_current)sellout or unsupported for the target HA flavor. The available flag is the only authority — MUST NOT substitute a region-wide zone listavailable=true); by default it should differ from the instance's current zone (cross-AZ disaster recovery, as recommended), but choosing the same zone as the current one is allowed (shortest intra-zone latency) — the choice is the user'sStep 3: Risk Disclosure
Step 4: Precondition Check
Verify all preconditions before any change:
--region <selected instance region>, --instance-id <selected instance id>, --target-az <selected target AZ>, and --output rds_single_to_ha_result_precheck.jsonSingle and ACTIVE, the derived HA flavor exists and the target availability zone is available for it, and automatic backups are enabledinstance_status entry carries the instance name, current availability zone, charge mode, storage type, and storage size; the flavor_support entry carries the authoritative single and HA spec codes. MUST source the Step 5 cost assessment and the Step 7 display from these values — MUST NOT source storage type or size from the Step 1 discovery output, which reports a different storage-type vocabularypre_check._all_pass, NOT from the process exit code — the script still writes the full report and exits 0 when a check fails, so the exit code only means the report was writtenStep 5: Cost Assessment
--region <region>, --compare-single-ha, --spec-code <flavor_support.spec_code>, --storage-size-gb <instance_status.volume_size>, --storage-type <instance_status.volume_type>, --charge-mode <instance_status.charge_mode>, and --output rds_cost_estimate_result.json--charge-mode with the instance's actual charge mode from the Step 4 pre-check report. An instance has exactly one billing mode, so the assessment MUST quote only that mode — postPaid quotes on-demand prices only, prePaid quotes monthly/yearly prices only. MUST NOT present both modes in the same assessment, and MUST NOT run the script without --charge-mode (which would quote both)postPaid, monthly/yearly when prePaid), carrying the single price, the HA price, the delta, and the multiple for the compute and storage components that actually carry values in the report. MUST NOT render a table for the other, non-applicable charge modeprePaid (yearly/monthly): the price difference is charged automatically at conversion; the account balance MUST be sufficientpostPaid (pay-per-use): no price-difference payment is requiredStep 6: Pre-conversion Monitoring Baseline
--region <region>, --instance-id <iid>, and --output rds_monitor_baseline.jsonStep 7: Conversion Confirmation and Execution
This step is irreversible (it changes the cloud instance from Single to Ha and raises the cost by the multiple quoted in Step 5). It requires explicit user confirmation.
--instance-id, --target-az (may be the same zone as the current one, chosen by the user in Step 2), and the instance billing mode (from the Step 4 pre-check report)is_auto_pay=true and Huawei Cloud auto-charges the price difference from the account — ensure the account balance is sufficient; pay-per-use (postPaid) instances do not need this price-difference paymenthcloud RDS ListBackups; before running it, the Agent MUST:
hcloud RDS ListBackups --help first and read the help text, rather than assuming the parameter names--instance_id), the region is that instance's region (--cli-region), and the project id is the one the pre-check already resolved (--project_id)--backup_type=auto) and use the first record's begin_time/end_time difference (the API returns records begin_time-descending; a full backup of the same instance takes a similar time)--skip-backup to convert directly (the automatic backup policy still applies and is recommended as a fallback); if the user keeps the backup, run without --skip-backup (same as the current default behavior)--region <region>, --instance-id <iid>, --target-az <az>, [--skip-backup], and --output rds_single_to_ha_result.json
--skip-backup is given), then performs the conversion and blocks until it finishes (typically about 10 minutes, longer for large data volumes)backup_id / job_id, or order_id for prepaid instances) to <output>.state.json so that processes killed by shell/session timeout can be resumedjob phase without a backup_idconversion.final_status (and the non-empty conversion/verification sections), NOT from the process exit code — on failure the report carries conversion.error.{error_code,error_msg} and conversion.detail, and the script exits non-zero; the report remains the authoritative verdictorder_id (BSS order) instead of a job_id; the script polls the instance state until type=Ha + status=ACTIVE instead of the job, so there is no percentage progress — MODIFYING INSTANCE TYPE may or may not be observed and does not gate completion; the conversion finishes in about 10 minutes and the result is judged by the same conversion.final_statusconvert.py, resume.py) through | tail -N (e.g. 2>&1 | tail -60): the scripts stream their progress logs to stderr in real time, while tail buffers until EOF, so when the process is killed by a shell/session timeout before EOF all logs are swallowed and the shell tool reports empty stdout/stderr/exit output. Run the command directly to see live progress; if output truncation is wanted, redirect stderr to a log file (2> run.log) and read it afterwards, or pipe through tee to stream live to both file and console. Empty shell output is a display-layer artifact, NOT evidence of failure — judge the outcome from the report as specified above--region <region>, --instance-id <iid>, [--target-az <az>], and --output rds_single_to_ha_result.json<output>.state.json, continues polling the existing backup/task (a persisted order_id is polled via the instance state), and writes a full report; it never reruns the conversion. It exits non-zero when the conversion or verification fails and keeps the state file for another resume attemptjob_id nor order_id (the original convert.py was killed after calling StartInstanceSingleToHaAction but before its response was captured), resume.py would have to (re-)issue the irreversible StartInstanceSingleToHaAction to continue. In that case:
--confirm flag; without --confirm it writes a conversion.refused=true report and exits non-zero, without calling StartInstanceSingleToHaActionresume.py with --confirm; without confirmation MUST NOT pass --confirmjob_id or order_id) do not need --confirm and do not (re-)issue the conversion--target-az; a failed conversion does not affect the instanceStep 8: Result Confirmation and Monitoring Comparison
type=Ha, status=ACTIVE, the ha field is non-empty, and the primary/standby nodes are ACTIVEaz_verified=true; when they are in the same zone the report marks same_az=true (a legitimate choice made in Step 2)--region <region>, --instance-id <iid>, and --output rds_monitor_after.json (same default 300-second window)Step 9: Workflow Summary