创建TiDB集群

接口URL

/api/v1/cluster/tidbs/create

请求方式

POST

Content-Type

application/json

认证方式

Bearer auth

请求Body参数

{
    "Alias": "test",
    "Arch": "aarch64",
    "Model": "share",
    "Platform": "tiup",
    "Version": "v6.5.0",
    "User": {
        "UserID": "root",
        "password": "pingcap"
    },
    "Labels": {
        "usefor": "test"
    },
    "Plan": {
        "global": {
            "ServerConfigs": {
                "tidb": {
                    "log.slow-threshold": 300,
                    "binlog.enable": false,
                    "binlog.ignore-error": false
                },
                "pd": {
                    "replication.location-labels": [
                        "zone",
                        "rack",
                        "host",
                        "port"
                    ]
                }
            },
            "Variables": {
                "tidb_distsql_scan_concurrency": "11"
            },
            "TiUPOptions": {
                "GlobalOptions": {
                    "User": "tidb",
                    "SSHPort": 22,
                    "deployDir": "/data/deploy",
                    "dataDir": "/data/data"
                }
            }
        },
        "Topology": [
            {
                "Component": "pd",
                "Expect": {
                    "Extra": {
                        "ClientPort": 2379
                    },
                    "Resource": {
                        "CPU": 4,
                        "Memory": 6
                    }
                }
            },
            {
                "Component": "tikv",
                "Expect": {
                    "Extra": {
                        "Port": 20160,
                        "StatusPort": 20180
                    },
                    "Resource": {
                        "CPU": 4,
                        "Memory": 6
                    }
                },
                "Labels": null
            },
            {
                "Component": "tikv",
                "Expect": {
                    "Extra": {
                        "Port": 20161,
                        "StatusPort": 20181
                    },
                    "Resource": {
                        "CPU": 4,
                        "Memory": 6
                    }
                },
                "Labels": null
            },
            {
                "Component": "monitor",
                "Expect": {
                    "Contral": "create",
                    "Extra": {
                        "Port": 9090
                    },
                    "Resource": {
                        "CPU": 4,
                        "Memory": 6
                    }
                },
                "Labels": null
            },
            {
                "Component": "grafana",
                "Expect": {
                    "Extra": {
                        "Port": 3000
                    },
                    "Resource": {
                        "CPU": 4,
                        "Memory": 6
                    }
                }
            },
            {
                "Component": "tidb",
                "Expect": {
                    "Extra": {
                        "Port": 4000,
                        "statusport": 10080
                    },
                    "Host": "172.17.0.2",
                    "Resource": {
                        "CPU": 4,
                        "Memory": 6
                    },
                    "Labels": {
                        "usefor": "oltp"
                    }
                }
            },
            {
                "Component": "tidb",
                "Expect": {
                    "Extra": {
                        "Port": 4001,
                        "statusport": 10081
                    },
                    "Host": "172.17.0.2",
                    "Resource": {
                        "CPU": 4,
                        "Memory": 6
                    },
                    "Labels": {
                        "usefor": "olap"
                    }
                }
            },
             {
              "Component": "cdc",
              "Expect": {
                  "Extra": {
                      "Port": 8300
                  },
                  "Resource": {
                      "cpu": 4,
                      "memory": 6
                  }
              }
          },
          {
              "Component": "pump",
              "Expect": {
                  "Extra": {
                      "Port": 8250
                  },
                  "Resource": {
                      "cpu": 4,
                      "memory": 6
                  }
              }
          },
            {
              "Component": "drainer",
              "Expect": {
                  "Extra": {
                      "Port": 8249,
                      "config": {
                          "syncer.db-type": "file",
                          "syncer.to.dir": "/path/to/save/binlog",
                          "syncer.to.retention-time": 7
                      }
                  },
                  "Resource": {
                      "cpu": 4,
                      "memory": 6
                  },
                  "Labels": {
                      "usefor": "pitr"
                  }
              }
          }
        ]
    },
    "Creator": "liusx"
}
参数名 示例值 参数类型
是否必填
参数描述
Alias test String 集群别名,可自定义,可重复
Arch aarch64 String 计算平台架构
Model share String 集群调度模式,share表示共享模式。exclusive表示独占模式。
Platform tiup String 控制平台,支持tiup或kubernetes
Version v6.5.0 String 集群版本
User - Object 数据库管控账号
User.UserID root String -
User.password pingcap String -
Labels - Object 自定义标签
Labels.usefor test String -
Plan - Object 预期的拓扑结构
Plan.global - Object 全局参数
Plan.global.ServerConfigs - Object TiDB集群的配置信息,组件级别的全局配置
Plan.global.ServerConfigs.tidb - Object -
Plan.global.ServerConfigs.
tidb.log.slow-threshold
300 Integer -
Plan.global.ServerConfigs.
tidb.binlog.enable
false Boolean -
Plan.global.ServerConfigs.
tidb.binlog.ignore-error
false Boolean -
Plan.global.ServerConfigs.pd - Object -
Plan.global.ServerConfigs.
pd.replication.location-labels
zone Array 集群默认数据放置规则标签
Plan.global.Variables - Object 数据库参数配置
Plan.global.Variables.
tidb_distsql_scan_concurrency
11 String -
Plan.global.TiUPOptions - Object TiUP相关参数
Plan.global.TiUPOptions.
GlobalOptions
- Object -
Plan.global.TiUPOptions.
GlobalOptions.User
tidb String 集群部署所在的用户
Plan.global.TiUPOptions.
GlobalOptions.SSHPort
22 Integer -
Plan.global.TiUPOptions.
GlobalOptions.deployDir
/data/deploy String -
Plan.global.TiUPOptions.
GlobalOptions.dataDir
/data/data String -
Plan.Topology - Array 新集群中各个组件的拓扑信息
Plan.Topology.Component pd String 组件名
Plan.Topology.Expect - Object -
Plan.Topology.Expect.Extra - Object 组件的自定义配置
Plan.Topology.Expect.
Extra.ClientPort
2379 Integer -
Plan.Topology.Expect.Resource - Object 组件需要的资源
Plan.Topology.Expect.
Resource.CPU
4 Integer -
Plan.Topology.Expect.
Resource.Memory
6 Integer -
Creator liusx String -

成功响应示例

{
    "Data": {
        "ClusterID": "tidb-6f2aee582662a5e5",
        "Expect": {
            "Resource": {
                "CPU": 28,
                "Memory": 42
            },
            "ComponentSize": {
                "grafana": 1,
                "monitor": 1,
                "pd": 1,
                "tidb": 2,
                "tikv": 2
            }
        },
        "TaskID": "tkf-dfd7bd85186e13f5"
    },
    "Success": true
}
参数名 示例值 参数类型 参数描述
Data - Object
Data.ClusterID tidb-6f2aee582662a5e5 String 集群ID, 集群的全局唯一编号
Data.Expect - Object
Data.Expect.Resource - Object
Data.Expect.Resource.CPU 28 Integer 集群使用的CPU总量
Data.Expect.Resource.Memory 42 Integer 集群使用的内存总量
Data.Expect.ComponentSize - Object
Data.Expect.ComponentSize.grafana 1 Integer
Data.Expect.ComponentSize.monitor 1 Integer
Data.Expect.ComponentSize.pd 1 Integer
Data.Expect.ComponentSize.tidb 2 Integer
Data.Expect.ComponentSize.tikv 2 Integer TiKV节点数量
Data.TaskID tkf-dfd7bd85186e13f5 String 启动的任务ID
Success true Boolean
© 2024 平凯星辰(北京)科技有限公司 all right reserved,powered by GitbookFile Modify: 2024-04-02 15:37:04

results matching ""

    No results matching ""