---
title: "从源实例克隆 my.cnf 部分参数到目标实例"
method: POST
path: "/mysql/mycnf-clone"
tags: ["mysql"]
---

# 从源实例克隆 my.cnf 部分参数到目标实例

`POST /mysql/mycnf-clone`

用于 slave 重建或迁移，保持新实例与 my.cnf 实例关键参数相同的场景
默认 clone 参数:

## Request body

- DbmServicesMysqlDbToolsDbactuatorPkgComponentsMysqlMycnfCloneComp
  - `extend` DbmServicesMysqlDbToolsDbactuatorPkgComponentsMysqlMycnfCloneParam
    - `items` string[] — 需要克隆哪些变量, 考虑到不同版本参数不一样，这里不要求指定一定存在; 只修改 mysqld 区。即失败忽略 有些参数是 readonly 的，只会保存到 my.cnf 中，如果与运行值不一样需要用户重启 默认值见 MycnfCloneItemsDefault
    - `persistent` 0 | 1 | 2, required — 是否持久化到 my.cnf 文件，0: 不持久化，1: 持久化, 2: 仅持久化但不修改运行时
    - `restart` 0 | 1 | 2, required — 指定是否 允许重启, 0:不重启, 1: 重启, 2:根据 items need_restart 自动判断是否重启
    - `src_instance` DbmServicesMysqlDbToolsDbactuatorPkgNativeInsObject, required
      - `charset` string — 连接字符集
      - `host` string — 当前实例的主机地址
      - `options` string — 其它选项
      - `port` integer — 当前实例的端口
      - `pwd` string — 连接当前实例的User Pwd
      - `socket` string — 连接socket
      - `user` string — 连接当前实例的User
    - `tgt_instance` DbmServicesMysqlDbToolsDbactuatorPkgNativeInsObject, required
      - `charset` string — 连接字符集
      - `host` string — 当前实例的主机地址
      - `options` string — 其它选项
      - `port` integer — 当前实例的端口
      - `pwd` string — 连接当前实例的User Pwd
      - `socket` string — 连接socket
      - `user` string — 连接当前实例的User
  - `general` DbmServicesMysqlDbToolsDbactuatorPkgComponentsGeneralParam
    - `runtime_account` DbmServicesMysqlDbToolsDbactuatorPkgComponentsRuntimeAccountParam
      - `admin_pwd` string — mysql admin 密码，环境变量 GENERAL_ACCOUNT_admin_pwd
      - `admin_user` string — mysql admin 账户，环境变量 GENERAL_ACCOUNT_admin_user
      - `backup_pwd` string — dbbackup pwd
      - `backup_user` string — dbbackup user
      - `monitor_access_all_pwd` string — mysql monitor@% 密码
      - `monitor_access_all_user` string — mysql monitor@%
      - `monitor_pwd` string — mysql monitor 密码，环境变量 GENERAL_ACCOUNT_monitor_pwd
      - `monitor_user` string — mysql monitor 账户，环境变量 GENERAL_ACCOUNT_monitor_user
      - `proxy_admin_pwd` string — proxy admin pwd
      - `proxy_admin_user` string — proxy admin user
      - `repl_pwd` string — repl pwd, 环境变量 GENERAL_ACCOUNT_repl_pwd
      - `repl_user` string — repl user, 环境变量 GENERAL_ACCOUNT_repl_user
      - `tdbctl_pwd` string
      - `tdbctl_user` string
      - `yw_pwd` string — yw pwd
      - `yw_user` string — yw user
    - `runtime_extend` DbmServicesMysqlDbToolsDbactuatorPkgComponentsRuntimeExtend
      - `mysql_sys_users` string[]

---

[API](https://skmtc.net/tencentblueking/apis/dbactuator-api.md) · [All operations](https://skmtc.net/tencentblueking/apis/dbactuator-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/tencentblueking/dbactuator-api/versions/dc22dd49fd50/schema)
