From 3ce63ee4320b95a3f878a07a331f56be2430c124 Mon Sep 17 00:00:00 2001 From: iSecloud <869820505@qq.com> Date: Fri, 13 Sep 2024 17:27:09 +0800 Subject: [PATCH] =?UTF-8?q?feat(backend):=20=E8=A7=84=E6=A0=BC=E5=B1=82?= =?UTF-8?q?=E7=BA=A7=E8=B0=83=E6=95=B4=20#7527?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dbm-ui/backend/components/domains.py | 1 + dbm-ui/backend/components/hcm/__init__.py | 10 + dbm-ui/backend/components/hcm/client.py | 30 + dbm-ui/backend/db_meta/apps.py | 3 +- dbm-ui/backend/db_meta/enums/spec.py | 119 + dbm-ui/backend/db_meta/init/spec_init.json | 1978 ++++++++--------- .../migrations/0043_auto_20241014_1042.py | 56 + dbm-ui/backend/db_meta/models/spec.py | 32 +- .../db_services/dbresource/constants.py | 19 +- .../backend/db_services/dbresource/filters.py | 4 +- .../db_services/dbresource/handlers.py | 33 +- dbm-ui/backend/db_services/dbresource/mock.py | 21 + .../db_services/dbresource/serializers.py | 50 +- .../db_services/dbresource/views/resource.py | 23 +- .../db_services/dbresource/views/sepc.py | 20 +- .../mysql/resources/tendbcluster/query.py | 3 +- .../mysql/resources/tendbcluster/yasg_slz.py | 2 +- .../redis/resources/redis_cluster/query.py | 5 +- dbm-ui/backend/env/apigw_domains.py | 1 + .../tests/mock_data/ticket/doris_flow.py | 7 +- .../tests/mock_data/ticket/mongodb_flow.py | 7 +- 21 files changed, 1236 insertions(+), 1188 deletions(-) create mode 100644 dbm-ui/backend/components/hcm/__init__.py create mode 100644 dbm-ui/backend/components/hcm/client.py create mode 100644 dbm-ui/backend/db_meta/enums/spec.py create mode 100644 dbm-ui/backend/db_meta/migrations/0043_auto_20241014_1042.py diff --git a/dbm-ui/backend/components/domains.py b/dbm-ui/backend/components/domains.py index 5b2c5d44ae..31d80da922 100644 --- a/dbm-ui/backend/components/domains.py +++ b/dbm-ui/backend/components/domains.py @@ -38,6 +38,7 @@ MYSQL_SIMULATION_DOMAIN = env.MYSQL_SIMULATION_DOMAIN or ESB_DOMAIN_TPL.format("db_simulation") NAMESERVICE_APIGW_DOMAIN = env.NAMESERVICE_APIGW_DOMAIN or ESB_DOMAIN_TPL.format("nameservice") HADB_APIGW_DOMAIN = env.HADB_APIGW_DOMAIN or ESB_DOMAIN_TPL.format("hadb") +HCM_APIGW_DOMAIN = env.HCM_APIGW_DOMAIN or ESB_DOMAIN_TPL.format("hcm") DBRESOURCE_APIGW_DOMAIN = env.DBRESOURCE_APIGW_DOMAIN or ESB_DOMAIN_TPL.format("dbresource") BACKUP_APIGW_DOMAIN = env.BACKUP_APIGW_DOMAIN or ESB_DOMAIN_TPL.format("backup") CELERY_SERVICE_APIGW_DOMAIN = env.CELERY_SERVICE_APIGW_DOMAIN or ESB_DOMAIN_TPL.format("celery_service") diff --git a/dbm-ui/backend/components/hcm/__init__.py b/dbm-ui/backend/components/hcm/__init__.py new file mode 100644 index 0000000000..aa5085c628 --- /dev/null +++ b/dbm-ui/backend/components/hcm/__init__.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +""" +TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-DB管理系统(BlueKing-BK-DBM) available. +Copyright (C) 2017-2023 THL A29 Limited, a Tencent company. All rights reserved. +Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. +You may obtain a copy of the License at https://opensource.org/licenses/MIT +Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on +an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the +specific language governing permissions and limitations under the License. +""" diff --git a/dbm-ui/backend/components/hcm/client.py b/dbm-ui/backend/components/hcm/client.py new file mode 100644 index 0000000000..632ba2d81b --- /dev/null +++ b/dbm-ui/backend/components/hcm/client.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +""" +TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-DB管理系统(BlueKing-BK-DBM) available. +Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved. +Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. +You may obtain a copy of the License at https://opensource.org/licenses/MIT +Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on +an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and limitations under the License. +""" + +from django.utils.translation import ugettext_lazy as _ + +from ..base import BaseApi +from ..domains import HADB_APIGW_DOMAIN + + +class _HCMApi(BaseApi): + MODULE = _("HCM海垒 服务") + BASE = HADB_APIGW_DOMAIN + + def __init__(self): + self.list_cvm_device = self.generate_data_api( + method="POST", + url="/api/v1/woa/config/findmany/config/cvm/device/detail/", + description=_("获取可用的CVM机型"), + ) + + +HCMApi = _HCMApi() diff --git a/dbm-ui/backend/db_meta/apps.py b/dbm-ui/backend/db_meta/apps.py index d086f146f1..d880c7ed99 100644 --- a/dbm-ui/backend/db_meta/apps.py +++ b/dbm-ui/backend/db_meta/apps.py @@ -33,7 +33,8 @@ def init_db_meta(sender, **kwargs): # 初始化规格配置 try: - Spec.init_spec() + if not Spec.objects.count(): + Spec.init_spec() except (IntegrityError, Exception) as err: # pylint: disable=broad-except: logger.warning(f"Spec init occur error: {err}, maybe already init, ignore...") diff --git a/dbm-ui/backend/db_meta/enums/spec.py b/dbm-ui/backend/db_meta/enums/spec.py new file mode 100644 index 0000000000..29c97c50cd --- /dev/null +++ b/dbm-ui/backend/db_meta/enums/spec.py @@ -0,0 +1,119 @@ +# -*- coding: utf-8 -*- +""" +TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-DB管理系统(BlueKing-BK-DBM) available. +Copyright (C) 2017-2023 THL A29 Limited, a Tencent company. All rights reserved. +Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. +You may obtain a copy of the License at https://opensource.org/licenses/MIT +Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on +an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the +specific language governing permissions and limitations under the License. +""" +from django.utils.translation import gettext_lazy as _ + +from backend.configuration.constants import DBType +from blue_krill.data_types.enum import EnumField, StructuredEnum + +# 兼容原来的字段,spec_cluster_type就是db_type +SpecClusterType = DBType + + +class SpecMachineType(str, StructuredEnum): + PROXY = EnumField("proxy", _("proxy")) + BACKEND = EnumField("backend", _("backend")) + + # redis主从、redis集群的后端规格同tendis cache一致 + TendisTwemproxyRedisInstance = EnumField("TwemproxyRedisInstance", _("TendisCache集群")) + TendisPredixyTendisplusCluster = EnumField("PredixyTendisplusCluster", _("Tendisplus存储版集群")) + TwemproxyTendisSSDInstance = EnumField("TwemproxyTendisSSDInstance", _("TendisSSD集群")) + + # RedisCluster这个Key不参与规格过滤,只在部署方案的时候生效 + TendisPredixyRedisCluster = EnumField("PredixyRedisCluster", _("RedisCluster集群")) + + ES_DATANODE = EnumField("es_datanode", _("es_datanode")) + ES_MASTER = EnumField("es_master", _("es_master")) + ES_CLIENT = EnumField("es_client", _("es_client")) + + BROKER = EnumField("broker", _("broker")) + ZOOKEEPER = EnumField("zookeeper", _("zookeeper")) + + HDFS_MASTER = EnumField("hdfs_master", _("hdfs_master")) + HDFS_DATANODE = EnumField("hdfs_datanode", _("hdfs_datanode")) + + PULSAR_ZOOKEEPER = EnumField("pulsar_zookeeper", _("pulsar_zookeeper")) + PULSAR_BOOKKEEPER = EnumField("pulsar_bookkeeper", _("pulsar_bookkeeper")) + PULSAR_BROKER = EnumField("pulsar_broker", _("pulsar_broker")) + + RIAK = EnumField("riak", _("riak")) + + SQLSERVER = EnumField("sqlserver", _("sqlserver")) + + MONGOS = EnumField("mongos", _("mongos")) + MONGODB = EnumField("mongodb", _("mongodb")) + MONOG_CONFIG = EnumField("mongo_config", _("mongo_config")) + + +# TODO: 规格迁移脚本函数,迁移完成后删除 +def migrate_spec(): + from django.db import transaction + + from backend.configuration.constants import DBType + from backend.db_meta.enums import ClusterType, MachineType + from backend.db_meta.models.spec import Spec + + # 原规格层级和新规格层级的映射 + MIGRATE_SPEC_MACHINE_MAP = { + MachineType.SINGLE: SpecMachineType.BACKEND, + MachineType.BACKEND: SpecMachineType.BACKEND, + MachineType.PROXY: SpecMachineType.PROXY, + MachineType.SPIDER: SpecMachineType.PROXY, + MachineType.REMOTE: SpecMachineType.BACKEND, + ClusterType.TendisTwemproxyRedisInstance: { + MachineType.TENDISCACHE: SpecMachineType.TendisTwemproxyRedisInstance, + MachineType.TWEMPROXY: SpecMachineType.PROXY, + }, + ClusterType.TwemproxyTendisSSDInstance: { + MachineType.TENDISSSD: SpecMachineType.TwemproxyTendisSSDInstance, + MachineType.TWEMPROXY: SpecMachineType.PROXY, + }, + ClusterType.TendisPredixyTendisplusCluster: { + MachineType.TENDISPLUS: SpecMachineType.TendisPredixyTendisplusCluster, + MachineType.PREDIXY: SpecMachineType.PROXY, + }, + ClusterType.TendisPredixyRedisCluster: { + MachineType.TENDISCACHE: SpecMachineType.TendisTwemproxyRedisInstance, + MachineType.PREDIXY: SpecMachineType.PROXY, + }, + ClusterType.TendisRedisInstance: { + MachineType.TENDISCACHE: SpecMachineType.TendisTwemproxyRedisInstance, + }, + MachineType.SQLSERVER_HA: SpecMachineType.SQLSERVER, + MachineType.SQLSERVER_SINGLE: SpecMachineType.SQLSERVER, + MachineType.MONGOS: SpecMachineType.MONGOS, + MachineType.MONGODB: SpecMachineType.MONGODB, + MachineType.MONOG_CONFIG: SpecMachineType.MONOG_CONFIG, + } + + specs = Spec.objects.all() + with transaction.atomic(): + for spec in specs: + db_type = ClusterType.cluster_type_to_db_type(spec.spec_cluster_type) + if db_type in [ + DBType.Es, + DBType.Kafka, + DBType.Hdfs, + DBType.InfluxDB, + DBType.Pulsar, + DBType.Vm, + DBType.Doris, + DBType.Riak, + ]: + continue + + if db_type == DBType.Redis: + spec.spec_machine_type = MIGRATE_SPEC_MACHINE_MAP[spec.spec_cluster_type][spec.spec_machine_type] + spec.spec_cluster_type = db_type + spec.save() + else: + spec.spec_machine_type = MIGRATE_SPEC_MACHINE_MAP[spec.spec_machine_type] + spec.spec_cluster_type = db_type + spec.save() diff --git a/dbm-ui/backend/db_meta/init/spec_init.json b/dbm-ui/backend/db_meta/init/spec_init.json index 78d7199705..e259bf644e 100644 --- a/dbm-ui/backend/db_meta/init/spec_init.json +++ b/dbm-ui/backend/db_meta/init/spec_init.json @@ -1,387 +1,96 @@ { - "es": { - "es_client": [ - { - "spec_name": "16核_32G", - "cpu": { - "max": 16, - "min": 16 - }, - "mem": { - "max": 32, - "min": 32 - }, - "device_class": [], - "storage_spec": [], - "desc": "client规格中", - "instance_num": 0, - "qps": {} - }, - { - "spec_name": "32核_64G", - "cpu": { - "max": 32, - "min": 32 - }, - "mem": { - "max": 64, - "min": 64 - }, - "device_class": [], - "storage_spec": [], - "desc": "client规格大", - "instance_num": 0, - "qps": {} - }, - { - "spec_name": "8核_32G", - "cpu": { - "max": 8, - "min": 8 - }, - "mem": { - "max": 32, - "min": 32 - }, - "device_class": [], - "storage_spec": [], - "desc": "client规格小", - "instance_num": 0, - "qps": {} - } - ], - "es_master": [ + "mysql": { + "backend": [ { - "spec_name": "2核_8G_50G", + "spec_name": "2核_4G_100G", "cpu": { - "max": 2, + "max": 4, "min": 2 }, "mem": { "max": 8, - "min": 8 + "min": 4 }, "device_class": [], "storage_spec": [ { - "size": 50, + "size": 100, "type": "SSD", - "mount_point": "/data" + "mount_point": "/data1" } ], - "desc": "master规格小", + "desc": "", "instance_num": 0, "qps": {} }, { - "spec_name": "4核_16G_50G", + "spec_name": "2核_1G_50G", "cpu": { "max": 4, - "min": 4 + "min": 2 }, "mem": { - "max": 16, - "min": 16 + "max": 4, + "min": 1 }, "device_class": [], "storage_spec": [ { "size": 50, - "type": "SSD", + "type": "ALL", "mount_point": "/data" } ], - "desc": "master规格中", + "desc": "", "instance_num": 0, "qps": {} }, { - "spec_name": "8核_32G_50G", - "cpu": { - "max": 8, - "min": 8 - }, - "mem": { - "max": 32, - "min": 32 - }, - "device_class": [], - "storage_spec": [ - { - "size": 50, - "type": "SSD", - "mount_point": "/data" - } - ], - "desc": "master规格大", - "instance_num": 0, - "qps": {} - } - ], - "es_datanode": [ - { - "spec_name": "4核_16G_100G", - "cpu": { - "max": 4, - "min": 4 - }, - "mem": { - "max": 16, - "min": 16 - }, - "device_class": [], - "storage_spec": [ - { - "size": 100, - "type": "SSD", - "mount_point": "/data" - } - ], - "desc": "热节点规格小", - "instance_num": 1, - "qps": {} - }, - { - "spec_name": "16核_64G_3500G", + "spec_name": "16核_32G_1000G", "cpu": { "max": 16, "min": 16 }, "mem": { "max": 64, - "min": 64 - }, - "device_class": [], - "storage_spec": [ - { - "size": 3500, - "type": "SSD", - "mount_point": "/data" - } - ], - "desc": "热节点规格大", - "instance_num": 1, - "qps": {} - }, - { - "spec_name": "8核_32G_800G", - "cpu": { - "max": 8, - "min": 8 - }, - "mem": { - "max": 32, "min": 32 }, "device_class": [], "storage_spec": [ { - "size": 800, - "type": "SSD", - "mount_point": "/data" - } - ], - "desc": "热节点规格中", - "instance_num": 1, - "qps": {} - }, - { - "spec_name": "2核_8G_100G", - "cpu": { - "max": 2, - "min": 2 - }, - "mem": { - "max": 8, - "min": 8 - }, - "device_class": [], - "storage_spec": [ - { - "size": 100, - "type": "HDD", - "mount_point": "/data" - } - ], - "desc": "冷节点规格小(假的)", - "instance_num": 1, - "qps": {} - }, - { - "spec_name": "86核_212G_3500G", - "cpu": { - "max": 86, - "min": 86 - }, - "mem": { - "max": 212, - "min": 212 - }, - "device_class": [], - "storage_spec": [ - { - "size": 3500, - "type": "HDD", - "mount_point": "/data" - }, - { - "size": 3500, - "type": "HDD", - "mount_point": "/data1" - }, - { - "size": 3500, - "type": "HDD", - "mount_point": "/data2" - }, - { - "size": 3500, - "type": "HDD", - "mount_point": "/data3" - }, - { - "size": 3500, - "type": "HDD", - "mount_point": "/data4" - }, - { - "size": 3500, - "type": "HDD", - "mount_point": "/data5" - }, - { - "size": 3500, - "type": "HDD", - "mount_point": "/data6" - }, - { - "size": 3500, - "type": "HDD", - "mount_point": "/data7" - }, - { - "size": 3500, - "type": "HDD", - "mount_point": "/data8" - }, - { - "size": 3500, - "type": "HDD", - "mount_point": "/data9" - }, - { - "size": 3500, - "type": "HDD", - "mount_point": "/data10" - }, - { - "size": 3500, - "type": "HDD", - "mount_point": "/data11" - } - ], - "desc": "冷节点规格大(da2)", - "instance_num": 4, - "qps": {} - } - ] - }, - "pulsar": { - "pulsar_zookeeper": [ - { - "spec_name": "2核_4G_100G", - "cpu": { - "max": 2, - "min": 2 - }, - "mem": { - "max": 4, - "min": 4 - }, - "device_class": [], - "storage_spec": [ - { - "size": 100, - "type": "SSD", + "size": 1000, + "type": "ALL", "mount_point": "/data" } ], - "desc": "zookeeper规格", + "desc": "", "instance_num": 0, "qps": {} - } - ], - "pulsar_bookkeeper": [ + }, { - "spec_name": "4核_16G_200G", + "spec_name": "4核_8G_100G", "cpu": { "max": 4, "min": 4 }, "mem": { - "max": 16, - "min": 16 - }, - "device_class": [], - "storage_spec": [ - { - "size": 200, - "type": "SSD", - "mount_point": "/data" - } - ], - "desc": "bookie规格小", - "instance_num": 0, - "qps": {} - }, - { - "spec_name": "8核_8G_800G", - "cpu": { - "max": 32, - "min": 8 - }, - "mem": { - "max": 32, + "max": 8, "min": 8 }, "device_class": [], "storage_spec": [ { - "size": 800, - "type": "SSD", + "size": 100, + "type": "ALL", "mount_point": "/data" } ], - "desc": "bookie规格中", + "desc": "", "instance_num": 0, "qps": {} }, { - "spec_name": "16核_64G_3500G", - "cpu": { - "max": 16, - "min": 16 - }, - "mem": { - "max": 64, - "min": 64 - }, - "device_class": [], - "storage_spec": [ - { - "size": 3500, - "type": "SSD", - "mount_point": "/data" - } - ], - "desc": "bookie规格大", - "instance_num": 0, - "qps": {} - } - ], - "pulsar_broker": [ - { - "spec_name": "8核_16G_100G", + "spec_name": "8核_16G_500G", "cpu": { "max": 8, "min": 8 @@ -393,17 +102,17 @@ "device_class": [], "storage_spec": [ { - "size": 100, - "type": "HDD", + "size": 500, + "type": "ALL", "mount_point": "/data" } ], - "desc": "broker规格小", + "desc": "", "instance_num": 0, "qps": {} }, { - "spec_name": "16核_32G_100G", + "spec_name": "16核_32G_500G", "cpu": { "max": 16, "min": 16 @@ -415,17 +124,17 @@ "device_class": [], "storage_spec": [ { - "size": 100, - "type": "HDD", + "size": 500, + "type": "ALL", "mount_point": "/data" } ], - "desc": "broker规格中", + "desc": "", "instance_num": 0, "qps": {} }, { - "spec_name": "32核_64G_100G", + "spec_name": "32核_64G_1000G", "cpu": { "max": 32, "min": 32 @@ -437,392 +146,468 @@ "device_class": [], "storage_spec": [ { - "size": 100, - "type": "HDD", + "size": 1000, + "type": "ALL", "mount_point": "/data" } ], - "desc": "broker规格大", + "desc": "", "instance_num": 0, "qps": {} - } - ] - }, - "kafka": { - "broker": [ + }, { - "spec_name": "4核_8G_200G", + "spec_name": "64核_128G_1000G", "cpu": { - "max": 4, - "min": 4 + "max": 64, + "min": 64 }, "mem": { - "max": 8, - "min": 8 + "max": 128, + "min": 128 }, "device_class": [], "storage_spec": [ { - "size": 200, + "size": 1000, "type": "SSD", "mount_point": "/data" } ], - "desc": "broker规格小", + "desc": "", "instance_num": 0, "qps": {} }, { - "spec_name": "8核_16G_800G", + "spec_name": "128核_256G_10G", "cpu": { - "max": 8, - "min": 8 + "max": 128, + "min": 128 }, "mem": { - "max": 16, - "min": 16 + "max": 256, + "min": 256 }, "device_class": [], "storage_spec": [ { - "size": 800, + "size": 100, "type": "SSD", "mount_point": "/data" - } - ], - "desc": "broker规格中", - "instance_num": 0, - "qps": {} - }, - { - "spec_name": "16核_64G_3500G", - "cpu": { - "max": 16, - "min": 16 - }, - "mem": { - "max": 64, - "min": 64 - }, - "device_class": [], - "storage_spec": [ + }, { - "size": 3500, + "size": 10, + "type": "HDD", + "mount_point": "/data1" + }, + { + "size": 100, + "type": "ALL", + "mount_point": "/data2" + }, + { + "size": 10, "type": "SSD", - "mount_point": "/data" + "mount_point": "/data12" + }, + { + "size": 10, + "type": "SSD", + "mount_point": "/data13" + }, + { + "size": 10, + "type": "SSD", + "mount_point": "/data14" + }, + { + "size": 10, + "type": "SSD", + "mount_point": "/data15" } ], - "desc": "broker规格大", + "desc": "", "instance_num": 0, "qps": {} } ], - "zookeeper": [ + "proxy": [ { - "spec_name": "2核_4G_100G", + "spec_name": "通用proxy配置", "cpu": { - "max": 2, + "max": 4, "min": 2 }, "mem": { - "max": 4, + "max": 8, "min": 4 }, "device_class": [], "storage_spec": [ { - "size": 100, - "type": "SSD", + "size": 50, + "type": "ALL", "mount_point": "/data" } ], - "desc": "zookeeper规格", + "desc": "", "instance_num": 0, "qps": {} } ] }, - "influxdb": { - "influxdb": [ + "es": { + "es_client": [ { - "spec_name": "32核_120G_1024G", + "spec_name": "16核_32G", + "cpu": { + "max": 16, + "min": 16 + }, + "mem": { + "max": 32, + "min": 31 + }, + "device_class": [], + "storage_spec": [], + "desc": "client规格中", + "instance_num": 0, + "qps": {} + }, + { + "spec_name": "32核_64G", "cpu": { "max": 32, "min": 32 }, "mem": { - "max": 130, - "min": 120 + "max": 64, + "min": 62 }, - "device_class": [], - "storage_spec": [ - { - "size": 1024, - "type": "SSD", - "mount_point": "/data1" - } - ], - "desc": "高规格", + "device_class": [], + "storage_spec": [], + "desc": "client规格大", "instance_num": 0, "qps": {} }, { - "spec_name": "16核_60G_400G", + "spec_name": "8核_16G", "cpu": { - "max": 16, - "min": 16 + "max": 8, + "min": 8 }, "mem": { - "max": 65, - "min": 60 + "max": 16, + "min": 15 }, "device_class": [], - "storage_spec": [ - { - "size": 400, - "type": "SSD", - "mount_point": "/data1" - } - ], - "desc": "中规格", + "storage_spec": [], + "desc": "client规格小", "instance_num": 0, "qps": {} }, { - "spec_name": "8核_16G_200G", + "spec_name": "8核_32G", "cpu": { "max": 8, "min": 8 }, "mem": { - "max": 17, - "min": 16 + "max": 32, + "min": 32 }, "device_class": [], - "storage_spec": [ - { - "size": 200, - "type": "SSD", - "mount_point": "/data1" - } - ], - "desc": "低规格", + "storage_spec": [], + "desc": "client规格小", "instance_num": 0, "qps": {} } - ] - }, - "hdfs": { - "hdfs_master": [ + ], + "es_master": [ { - "spec_name": "2核_4G_100G", + "spec_name": "4核_8G_50G", "cpu": { "max": 4, - "min": 2 + "min": 4 }, "mem": { - "max": 16, - "min": 4 + "max": 8, + "min": 7 }, "device_class": [], "storage_spec": [ { - "size": 100, + "size": 48, "type": "ALL", "mount_point": "/data" } ], - "desc": "ZK/JN规格", + "desc": "小规格master", "instance_num": 0, "qps": {} }, { - "spec_name": "2核_8G_100G", + "spec_name": "8核_16G_50G", "cpu": { - "max": 2, - "min": 2 - }, - "mem": { "max": 8, "min": 8 }, + "mem": { + "max": 16, + "min": 15 + }, "device_class": [], "storage_spec": [ { - "size": 100, + "size": 48, "type": "ALL", "mount_point": "/data" } ], - "desc": "NameNode规格-小", + "desc": "中规格master", "instance_num": 0, "qps": {} }, { - "spec_name": "16核_128G_1000G", + "spec_name": "8核_32G_50G", "cpu": { - "max": 48, + "max": 16, "min": 16 }, "mem": { - "max": 192, - "min": 128 + "max": 32, + "min": 31 }, "device_class": [], "storage_spec": [ { - "size": 1000, + "size": 48, "type": "ALL", "mount_point": "/data" } ], - "desc": "NameNode规格-大", + "desc": "大规格master", "instance_num": 0, "qps": {} }, { - "spec_name": "8核_32G_100G", + "spec_name": "2核_8G_50G", "cpu": { - "max": 16, + "max": 2, + "min": 2 + }, + "mem": { + "max": 8, "min": 8 }, + "device_class": [], + "storage_spec": [ + { + "size": 50, + "type": "SSD", + "mount_point": "/data" + } + ], + "desc": "master规格小", + "instance_num": 0, + "qps": {} + }, + { + "spec_name": "4核_16G_50G", + "cpu": { + "max": 4, + "min": 4 + }, "mem": { - "max": 64, - "min": 32 + "max": 16, + "min": 16 }, "device_class": [], "storage_spec": [ { - "size": 100, - "type": "ALL", + "size": 50, + "type": "SSD", "mount_point": "/data" } ], - "desc": "NameNode规格-中", + "desc": "master规格中", "instance_num": 0, "qps": {} } ], - "hdfs_datanode": [ + "es_datanode": [ { - "spec_name": "2核_8G_100G", + "spec_name": "4核_8G_100G", "cpu": { - "max": 8, - "min": 2 + "max": 4, + "min": 4 }, "mem": { - "max": 32, - "min": 8 + "max": 8, + "min": 7 }, "device_class": [], "storage_spec": [ { - "size": 100, + "size": 97, "type": "ALL", - "mount_point": "/data1" + "mount_point": "/data" } ], - "desc": "DataNode规格-小", - "instance_num": 0, + "desc": "最小规格热节点", + "instance_num": 1, "qps": {} }, { - "spec_name": "16核_64G_3500G", + "spec_name": "I6t.4XLARGE56", "cpu": { "max": 16, "min": 16 }, "mem": { - "max": 64, - "min": 64 + "max": 56, + "min": 54 }, "device_class": [], "storage_spec": [ { "size": 3500, - "type": "ALL", - "mount_point": "/data1" + "type": "SSD", + "mount_point": "/data" } ], - "desc": "DataNode规格-中", - "instance_num": 0, + "desc": "大规格热节点(i6t)", + "instance_num": 1, "qps": {} }, { - "spec_name": "16核_64G_12000G", + "spec_name": "8核_16G_100G", "cpu": { - "max": 48, - "min": 16 + "max": 8, + "min": 8 }, "mem": { - "max": 256, - "min": 64 + "max": 16, + "min": 15 }, "device_class": [], "storage_spec": [ { - "size": 12000, + "size": 97, "type": "ALL", - "mount_point": "/data1" + "mount_point": "/data" } ], - "desc": "DataNode规格-大", - "instance_num": 0, + "desc": "小规格热节点", + "instance_num": 1, "qps": {} - } - ] - }, - "tendbha": { - "backend": [ + }, { - "spec_name": "2核_1G_50G", + "spec_name": "86核_212G_3500G", "cpu": { - "max": 4, - "min": 2 + "max": 86, + "min": 86 }, "mem": { - "max": 4, - "min": 1 + "max": 212, + "min": 206 }, "device_class": [], "storage_spec": [ { - "size": 50, - "type": "ALL", + "size": 3500, + "type": "HDD", "mount_point": "/data" + }, + { + "size": 3500, + "type": "HDD", + "mount_point": "/data1" + }, + { + "size": 3500, + "type": "HDD", + "mount_point": "/data2" + }, + { + "size": 3500, + "type": "HDD", + "mount_point": "/data3" + }, + { + "size": 3500, + "type": "HDD", + "mount_point": "/data4" + }, + { + "size": 3500, + "type": "HDD", + "mount_point": "/data5" + }, + { + "size": 3500, + "type": "HDD", + "mount_point": "/data6" + }, + { + "size": 3500, + "type": "HDD", + "mount_point": "/data7" + }, + { + "size": 3500, + "type": "HDD", + "mount_point": "/data8" + }, + { + "size": 3500, + "type": "HDD", + "mount_point": "/data9" + }, + { + "size": 3500, + "type": "HDD", + "mount_point": "/data10" + }, + { + "size": 3500, + "type": "HDD", + "mount_point": "/data11" } ], - "desc": "", - "instance_num": 0, + "desc": "专用规格冷节点", + "instance_num": 4, "qps": {} }, { - "spec_name": "4核_8G_100G", + "spec_name": "IT5.4XLARGE64", "cpu": { - "max": 4, - "min": 4 + "max": 16, + "min": 16 }, "mem": { - "max": 8, - "min": 8 + "max": 64, + "min": 62 }, "device_class": [], "storage_spec": [ { - "size": 100, - "type": "ALL", + "size": 3500, + "type": "SSD", "mount_point": "/data" } ], - "desc": "", - "instance_num": 0, - "qps": {} + "desc": "大规格热节点(IT5)", + "instance_num": 1, + "qps": { + "max": null, + "min": null + } }, { - "spec_name": "8核_16G_500G", + "spec_name": "4核_16G_100G", "cpu": { - "max": 8, - "min": 8 + "max": 4, + "min": 4 }, "mem": { "max": 16, @@ -830,244 +615,246 @@ }, "device_class": [], "storage_spec": [ - { - "size": 500, - "type": "ALL", + { + "size": 100, + "type": "SSD", "mount_point": "/data" } ], - "desc": "", - "instance_num": 0, + "desc": "热节点规格小", + "instance_num": 1, "qps": {} }, { - "spec_name": "16核_32G_500G", + "spec_name": "16核_64G_3500G", "cpu": { "max": 16, "min": 16 }, "mem": { - "max": 32, - "min": 32 + "max": 64, + "min": 64 }, "device_class": [], "storage_spec": [ { - "size": 500, - "type": "ALL", + "size": 3500, + "type": "SSD", "mount_point": "/data" } ], - "desc": "", - "instance_num": 0, + "desc": "热节点规格大", + "instance_num": 1, "qps": {} }, { - "spec_name": "16核_32G_1000G", + "spec_name": "8核_32G_800G", "cpu": { - "max": 16, - "min": 16 + "max": 8, + "min": 8 }, "mem": { - "max": 64, + "max": 32, "min": 32 }, "device_class": [], "storage_spec": [ { - "size": 1000, - "type": "ALL", + "size": 800, + "type": "SSD", "mount_point": "/data" } ], - "desc": "", - "instance_num": 0, + "desc": "热节点规格中", + "instance_num": 1, "qps": {} }, { - "spec_name": "32核_64G_1000G", + "spec_name": "2核_8G_100G", "cpu": { - "max": 32, - "min": 32 + "max": 2, + "min": 2 }, "mem": { - "max": 64, - "min": 64 + "max": 8, + "min": 8 }, "device_class": [], "storage_spec": [ { - "size": 1000, - "type": "ALL", + "size": 100, + "type": "HDD", "mount_point": "/data" } ], - "desc": "", - "instance_num": 0, + "desc": "冷节点规格小(假的)", + "instance_num": 1, "qps": {} - }, + } + ] + }, + "pulsar": { + "pulsar_zookeeper": [ { - "spec_name": "64核_128G_1000G", + "spec_name": "2核_8G_100G", "cpu": { - "max": 64, - "min": 64 + "max": 2, + "min": 2 }, "mem": { - "max": 128, - "min": 128 + "max": 8, + "min": 4 }, "device_class": [], "storage_spec": [ { - "size": 1000, + "size": 100, "type": "SSD", "mount_point": "/data" } ], - "desc": "", + "desc": "zookeeper规格", "instance_num": 0, "qps": {} - } - ], - "proxy": [ + }, { - "spec_name": "通用proxy配置", + "spec_name": "2核_4G_100G", "cpu": { - "max": 4, + "max": 2, "min": 2 }, "mem": { - "max": 8, + "max": 4, "min": 4 }, "device_class": [], "storage_spec": [ { - "size": 50, - "type": "ALL", + "size": 100, + "type": "SSD", "mount_point": "/data" } ], - "desc": "", + "desc": "zookeeper规格", "instance_num": 0, "qps": {} } - ] - }, - "tendbsingle": { - "single": [ + ], + "pulsar_bookkeeper": [ { - "spec_name": "2核_1G_50G", + "spec_name": "4核_16G_200G", "cpu": { "max": 4, - "min": 2 + "min": 4 }, "mem": { - "max": 4, - "min": 1 + "max": 16, + "min": 16 }, "device_class": [], "storage_spec": [ { - "size": 50, - "type": "ALL", + "size": 200, + "type": "SSD", "mount_point": "/data" } ], - "desc": "", + "desc": "bookie规格小", "instance_num": 0, "qps": {} }, { - "spec_name": "4核_8G_100G", + "spec_name": "8核_8G_800G", "cpu": { - "max": 4, - "min": 4 + "max": 32, + "min": 8 }, "mem": { - "max": 8, + "max": 32, "min": 8 }, "device_class": [], "storage_spec": [ { - "size": 100, - "type": "ALL", + "size": 800, + "type": "SSD", "mount_point": "/data" } ], - "desc": "", + "desc": "bookie规格中", "instance_num": 0, "qps": {} }, { - "spec_name": "8核_16G_500G", + "spec_name": "16核_64G_3500G", "cpu": { - "max": 8, - "min": 8 - }, - "mem": { "max": 16, "min": 16 }, + "mem": { + "max": 64, + "min": 64 + }, "device_class": [], "storage_spec": [ { - "size": 500, - "type": "ALL", + "size": 3500, + "type": "SSD", "mount_point": "/data" } ], - "desc": "", + "desc": "bookie规格大", "instance_num": 0, "qps": {} - }, + } + ], + "pulsar_broker": [ { - "spec_name": "16核_32G_500G", + "spec_name": "8核_16G_100G", "cpu": { - "max": 16, - "min": 16 + "max": 8, + "min": 8 }, "mem": { - "max": 32, - "min": 32 + "max": 16, + "min": 16 }, "device_class": [], "storage_spec": [ { - "size": 500, - "type": "ALL", + "size": 100, + "type": "HDD", "mount_point": "/data" } ], - "desc": "", + "desc": "broker规格小", "instance_num": 0, "qps": {} }, { - "spec_name": "16核_32G_1000G", + "spec_name": "16核_32G_100G", "cpu": { "max": 16, "min": 16 }, "mem": { - "max": 64, + "max": 32, "min": 32 }, "device_class": [], "storage_spec": [ { - "size": 1000, - "type": "ALL", + "size": 100, + "type": "HDD", "mount_point": "/data" } ], - "desc": "", + "desc": "broker规格中", "instance_num": 0, "qps": {} }, { - "spec_name": "32核_64G_1000G", + "spec_name": "32核_64G_100G", "cpu": { "max": 32, "min": 32 @@ -1079,326 +866,338 @@ "device_class": [], "storage_spec": [ { - "size": 1000, - "type": "ALL", + "size": 100, + "type": "HDD", "mount_point": "/data" } ], - "desc": "", + "desc": "broker规格大", "instance_num": 0, "qps": {} - }, + } + ] + }, + "kafka": { + "broker": [ { - "spec_name": "64核_128G_1000G", + "spec_name": "4核_8G_100G", "cpu": { - "max": 64, - "min": 64 + "max": 4, + "min": 4 }, "mem": { - "max": 128, - "min": 128 + "max": 8, + "min": 7 }, "device_class": [], "storage_spec": [ { - "size": 1000, - "type": "SSD", + "size": 97, + "type": "ALL", "mount_point": "/data" } ], - "desc": "", + "desc": "最小broker规格", "instance_num": 0, "qps": {} - } - ] - }, - "TwemproxyRedisInstance": { - "tendiscache": [ + }, { - "spec_name": "2c_4g_50gb", + "spec_name": "8核_16G_100G", "cpu": { - "max": 2, - "min": 2 + "max": 8, + "min": 8 }, "mem": { - "max": 4, - "min": 3 + "max": 16, + "min": 15 }, "device_class": [], - "storage_spec": [], - "desc": "", + "storage_spec": [ + { + "size": 100, + "type": "ALL", + "mount_point": "/data" + } + ], + "desc": "小规格broker", "instance_num": 0, "qps": {} }, { - "spec_name": "2c_8g_100gb", + "spec_name": "16核_64G_3500G", "cpu": { - "max": 4, - "min": 2 + "max": 16, + "min": 16 }, "mem": { - "max": 8, - "min": 7 + "max": 64, + "min": 62 }, "device_class": [], - "storage_spec": [], - "desc": "", + "storage_spec": [ + { + "size": 3500, + "type": "SSD", + "mount_point": "/data" + } + ], + "desc": "broker规格大", "instance_num": 0, "qps": {} }, { - "spec_name": "4c_16g_200gb", + "spec_name": "32核_128G_7000G", "cpu": { - "max": 6, - "min": 4 + "max": 32, + "min": 32 }, "mem": { - "max": 16, - "min": 15 + "max": 128, + "min": 124 }, "device_class": [], "storage_spec": [ { - "size": 200, - "type": "ALL", + "size": 3500, + "type": "SSD", "mount_point": "/data" + }, + { + "size": 3500, + "type": "SSD", + "mount_point": "/data1" } ], - "desc": "", + "desc": "broker规格超大", "instance_num": 0, - "qps": {} + "qps": { + "max": null, + "min": null + } }, { - "spec_name": "4c_32g_300gb", + "spec_name": "16核_32G_100G", "cpu": { - "max": 8, - "min": 4 + "max": 16, + "min": 16 }, "mem": { "max": 32, - "min": 30 + "min": 31 }, "device_class": [], "storage_spec": [ { - "size": 300, + "size": 100, "type": "ALL", "mount_point": "/data" } ], - "desc": "", + "desc": "中规格broker", "instance_num": 0, - "qps": {} + "qps": { + "max": null, + "min": null + } }, { - "spec_name": "8c_64g_400gb", + "spec_name": "4核_8G_200G", "cpu": { - "max": 16, - "min": 8 + "max": 4, + "min": 4 }, "mem": { - "max": 64, - "min": 61 + "max": 8, + "min": 8 }, "device_class": [], "storage_spec": [ { - "size": 400, - "type": "HDD", + "size": 200, + "type": "SSD", "mount_point": "/data" } ], - "desc": "", + "desc": "broker规格小", "instance_num": 0, "qps": {} }, { - "spec_name": "16c_128g_600gb", + "spec_name": "8核_16G_800G", "cpu": { - "max": 32, - "min": 16 + "max": 8, + "min": 8 }, "mem": { - "max": 128, - "min": 125 + "max": 16, + "min": 16 }, "device_class": [], "storage_spec": [ { - "size": 600, - "type": "HDD", + "size": 800, + "type": "SSD", "mount_point": "/data" } ], - "desc": "", + "desc": "broker规格中", "instance_num": 0, "qps": {} } ], - "twemproxy": [ + "zookeeper": [ { - "spec_name": "2c_4g_50g", + "spec_name": "2核_8G_20G", "cpu": { "max": 2, "min": 2 }, "mem": { - "max": 4, - "min": 3 + "max": 8, + "min": 7 }, "device_class": [], "storage_spec": [ { - "size": 50, + "size": 19, "type": "ALL", "mount_point": "/data" } ], - "desc": "基础机型", + "desc": "", "instance_num": 0, - "qps": {} + "qps": { + "max": 0, + "min": 0 + } }, { - "spec_name": "4c_16g_50g", + "spec_name": "2核_4G_100G", "cpu": { - "max": 6, - "min": 4 + "max": 2, + "min": 2 }, "mem": { - "max": 16, - "min": 15 + "max": 4, + "min": 4 }, "device_class": [], "storage_spec": [ { - "size": 50, - "type": "ALL", + "size": 100, + "type": "SSD", "mount_point": "/data" } ], - "desc": "中等机型", + "desc": "zookeeper规格", "instance_num": 0, "qps": {} - }, + } + ] + }, + "influxdb": { + "influxdb": [ { - "spec_name": "8c_32g_100g", + "spec_name": "32核_120G_1024G", "cpu": { - "max": 8, - "min": 6 + "max": 32, + "min": 32 }, "mem": { - "max": 32, - "min": 30 + "max": 130, + "min": 120 }, "device_class": [], "storage_spec": [ { - "size": 100, - "type": "ALL", - "mount_point": "/data" + "size": 1024, + "type": "SSD", + "mount_point": "/data1" } ], - "desc": "高等机型", + "desc": "高规格", "instance_num": 0, "qps": {} - } - ] - }, - "TwemproxyTendisSSDInstance": { - "tendisssd": [ + }, { - "spec_name": "16c_64g_1.5tb", + "spec_name": "16核_60G_400G", "cpu": { "max": 16, "min": 16 }, "mem": { - "max": 66, - "min": 55 + "max": 65, + "min": 60 }, "device_class": [], "storage_spec": [ { - "size": 1500, - "type": "ALL", - "mount_point": "/data" - }, - { - "size": 1500, + "size": 400, "type": "SSD", "mount_point": "/data1" } ], - "desc": "", + "desc": "中规格", "instance_num": 0, - "qps": { - "max": 70000, - "min": 50000 - } + "qps": {} }, { - "spec_name": "32c_128g_3.5tb", + "spec_name": "8核_16G_200G", "cpu": { - "max": 32, - "min": 32 + "max": 8, + "min": 8 }, "mem": { - "max": 130, - "min": 110 + "max": 17, + "min": 16 }, "device_class": [], "storage_spec": [ { - "size": 3500, - "type": "ALL", - "mount_point": "/data" - }, - { - "size": 3500, + "size": 200, "type": "SSD", "mount_point": "/data1" } ], - "desc": "", + "desc": "低规格", "instance_num": 0, - "qps": { - "max": 100000, - "min": 80000 - } - } - ], - "twemproxy": [ + "qps": {} + }, { - "spec_name": "2c_4g_50g", + "spec_name": "1核_1G_10G", "cpu": { - "max": 2, - "min": 2 + "max": 256, + "min": 1 }, "mem": { - "max": 4, - "min": 3 + "max": 256, + "min": 1 }, "device_class": [], "storage_spec": [ { - "size": 50, + "size": 10, "type": "ALL", "mount_point": "/data" } ], - "desc": "基础机型", + "desc": "21212", "instance_num": 0, "qps": {} - }, + } + ] + }, + "hdfs": { + "hdfs_master": [ { - "spec_name": "4c_16g_50g", + "spec_name": "2核_8G_50G", "cpu": { - "max": 6, - "min": 4 + "max": 4, + "min": 2 }, "mem": { "max": 16, - "min": 15 + "min": 8 }, "device_class": [], "storage_spec": [ @@ -1408,19 +1207,19 @@ "mount_point": "/data" } ], - "desc": "中等机型", + "desc": "ZK/JN规格", "instance_num": 0, "qps": {} }, { - "spec_name": "8c_32g_100g", + "spec_name": "2核_8G_100G", "cpu": { - "max": 8, - "min": 6 + "max": 2, + "min": 2 }, "mem": { - "max": 32, - "min": 30 + "max": 8, + "min": 8 }, "device_class": [], "storage_spec": [ @@ -1430,53 +1229,41 @@ "mount_point": "/data" } ], - "desc": "高等机型", + "desc": "NameNode规格-小", "instance_num": 0, "qps": {} - } - ] - }, - "PredixyTendisplusCluster": { - "tendisplus": [ + }, { - "spec_name": "2c_4g_50g", + "spec_name": "16核_128G_1000G", "cpu": { - "max": 2, - "min": 2 + "max": 48, + "min": 16 }, "mem": { - "max": 4, - "min": 3 + "max": 192, + "min": 128 }, "device_class": [], "storage_spec": [ { - "size": 50, + "size": 1000, "type": "ALL", "mount_point": "/data" - }, - { - "size": 50, - "type": "SSD", - "mount_point": "/data1" } ], - "desc": "", + "desc": "NameNode规格-大", "instance_num": 0, - "qps": { - "max": 10000, - "min": 5000 - } + "qps": {} }, { - "spec_name": "2c_8g_100g", + "spec_name": "8核_32G_100G", "cpu": { - "max": 4, - "min": 2 + "max": 16, + "min": 8 }, "mem": { - "max": 8, - "min": 6 + "max": 64, + "min": 32 }, "device_class": [], "storage_spec": [ @@ -1484,142 +1271,106 @@ "size": 100, "type": "ALL", "mount_point": "/data" - }, - { - "size": 100, - "type": "SSD", - "mount_point": "/data1" } ], - "desc": "", + "desc": "NameNode规格-中", "instance_num": 0, - "qps": { - "max": 15000, - "min": 10000 - } + "qps": {} }, { - "spec_name": "4c_16g_200g", + "spec_name": "2核_4G_100G", "cpu": { - "max": 6, - "min": 4 + "max": 4, + "min": 2 }, "mem": { "max": 16, - "min": 15 + "min": 4 }, "device_class": [], "storage_spec": [ { - "size": 200, + "size": 100, "type": "ALL", "mount_point": "/data" - }, - { - "size": 200, - "type": "SSD", - "mount_point": "/data1" } - ], - "desc": "", - "instance_num": 0, - "qps": { - "max": 30000, - "min": 20000 - } - }, + ], + "desc": "ZK/JN规格", + "instance_num": 0, + "qps": {} + } + ], + "hdfs_datanode": [ { - "spec_name": "4c_32g_500g", + "spec_name": "2核_8G_100G", "cpu": { "max": 8, - "min": 4 + "min": 2 }, "mem": { "max": 32, - "min": 30 + "min": 8 }, "device_class": [], "storage_spec": [ { - "size": 500, + "size": 100, "type": "ALL", - "mount_point": "/data" - }, - { - "size": 500, - "type": "SSD", "mount_point": "/data1" } ], - "desc": "", + "desc": "DataNode规格-小", "instance_num": 0, - "qps": { - "max": 50000, - "min": 30000 - } + "qps": {} }, { - "spec_name": "16c_64g_1.5tb", + "spec_name": "16核_64G_3500G", "cpu": { "max": 16, "min": 16 }, "mem": { - "max": 66, - "min": 55 + "max": 64, + "min": 64 }, "device_class": [], "storage_spec": [ { - "size": 1500, + "size": 3500, "type": "ALL", - "mount_point": "/data" - }, - { - "size": 1500, - "type": "SSD", "mount_point": "/data1" } ], - "desc": "", + "desc": "DataNode规格-中", "instance_num": 0, - "qps": { - "max": 80000, - "min": 50000 - } + "qps": {} }, { - "spec_name": "32c_128g_3.5tb", + "spec_name": "16核_64G_12000G", "cpu": { - "max": 32, - "min": 32 + "max": 48, + "min": 16 }, "mem": { - "max": 130, - "min": 110 + "max": 256, + "min": 64 }, "device_class": [], "storage_spec": [ { - "size": 3500, + "size": 12000, "type": "ALL", - "mount_point": "/data" - }, - { - "size": 3500, - "type": "SSD", "mount_point": "/data1" } ], - "desc": "", + "desc": "DataNode规格-大", "instance_num": 0, - "qps": { - "max": 120000, - "min": 80000 - } + "qps": {} } - ], - "predixy": [ + ] + }, + "redis": { + "TwemproxyRedisInstance": [ { "spec_name": "2c_4g_50g", "cpu": { @@ -1638,156 +1389,124 @@ "mount_point": "/data" } ], - "desc": "基础机型", + "desc": "", "instance_num": 0, "qps": {} }, { - "spec_name": "4c_16g_50g", + "spec_name": "2c_8g_100g", "cpu": { - "max": 6, - "min": 4 + "max": 4, + "min": 2 }, "mem": { - "max": 16, - "min": 15 + "max": 8, + "min": 7 }, "device_class": [], "storage_spec": [ { - "size": 50, - "type": "ALL", + "size": 100, + "type": "HDD", "mount_point": "/data" } ], - "desc": "中等机型", + "desc": "", "instance_num": 0, "qps": {} }, { - "spec_name": "8c_32g_100g", + "spec_name": "4c_16g_200g", "cpu": { - "max": 8, - "min": 6 + "max": 6, + "min": 4 }, "mem": { - "max": 32, - "min": 30 + "max": 16, + "min": 15 }, "device_class": [], "storage_spec": [ { - "size": 100, - "type": "ALL", + "size": 200, + "type": "HDD", "mount_point": "/data" } ], - "desc": "高等机型", + "desc": "", "instance_num": 0, "qps": {} - } - ] - }, - "PredixyRedisCluster": { - "predixy": [ + }, { - "spec_name": "2c_4g_50g", + "spec_name": "4c_32g_300g", "cpu": { - "max": 2, - "min": 2 + "max": 8, + "min": 4 }, "mem": { - "max": 4, - "min": 3 + "max": 32, + "min": 30 }, - "device_class": [ - "S5.MEDIUM4", - "S5t.MEDIUM4", - "SA2.MEDIUM4" - ], + "device_class": [], "storage_spec": [ { - "size": 50, - "type": "ALL", + "size": 300, + "type": "HDD", "mount_point": "/data" } ], - "desc": "基础机型", + "desc": "", "instance_num": 0, - "qps": { - "max": 0, - "min": 0 - } + "qps": {} }, { - "spec_name": "4c_16g_50g", + "spec_name": "8c_64g_400g", "cpu": { - "max": 6, - "min": 4 + "max": 16, + "min": 8 }, "mem": { - "max": 16, - "min": 15 + "max": 64, + "min": 61 }, - "device_class": [ - "S5.LARGE16", - "S5.2XLARGE16", - "S5t.2XLARGE16", - "S5t.LARGE16", - "SA2.2XLARGE16", - "SA3.LARGE16" - ], + "device_class": [], "storage_spec": [ { - "size": 50, - "type": "ALL", + "size": 400, + "type": "HDD", "mount_point": "/data" } ], - "desc": "中等机型", + "desc": "", "instance_num": 0, - "qps": { - "max": 0, - "min": 0 - } + "qps": {} }, { - "spec_name": "8c_32g_100db", + "spec_name": "16c_128g_600g", "cpu": { - "max": 8, - "min": 6 + "max": 32, + "min": 16 }, "mem": { - "max": 32, - "min": 30 + "max": 128, + "min": 125 }, - "device_class": [ - "S5.2XLARGE32", - "S5.4XLARGE32", - "S5t.2XLARGE32", - "SA2.4XLARGE32", - "SA3.2XLARGE32", - "SN3ne.2XLARGE32", - "SN3ne.4XLARGE32" - ], + "device_class": [], "storage_spec": [ { - "size": 100, + "size": 600, "type": "ALL", "mount_point": "/data" } ], - "desc": "高等机型", + "desc": "", "instance_num": 0, - "qps": { - "max": 0, - "min": 0 - } + "qps": {} } ], - "tendiscache": [ + "proxy": [ { - "spec_name": "2c_4g_50gb", + "spec_name": "2c_4g_50g", "cpu": { "max": 2, "min": 2 @@ -1796,47 +1515,20 @@ "max": 4, "min": 3 }, - "device_class": [ - "S5.MEDIUM4", - "S5t.MEDIUM4", - "SA2.MEDIUM4" - ], - "storage_spec": [], - "desc": "", - "instance_num": 0, - "qps": { - "max": 0, - "min": 0 - } - }, - { - "spec_name": "2c_8g_100gb", - "cpu": { - "max": 4, - "min": 2 - }, - "mem": { - "max": 8, - "min": 7 - }, - "device_class": [ - "S5.MEDIUM8", - "S5t.MEDIUM8", - "S5.LARGE8", - "S5t.LARGE8", - "SA2.LARGE8", - "SN3ne.LARGE8" + "device_class": [], + "storage_spec": [ + { + "size": 50, + "type": "ALL", + "mount_point": "/data" + } ], - "storage_spec": [], - "desc": "", + "desc": "基础机型", "instance_num": 0, - "qps": { - "max": 0, - "min": 0 - } + "qps": {} }, { - "spec_name": "4c_16g_200db", + "spec_name": "4c_16g_200g", "cpu": { "max": 6, "min": 4 @@ -1845,12 +1537,7 @@ "max": 16, "min": 15 }, - "device_class": [ - "S5.LARGE16", - "S5.2XLARGE16", - "S5t.2XLARGE16", - "SA2.2XLARGE16" - ], + "device_class": [], "storage_spec": [ { "size": 200, @@ -1858,108 +1545,101 @@ "mount_point": "/data" } ], - "desc": "", + "desc": "中等机型", "instance_num": 0, - "qps": { - "max": 0, - "min": 0 - } + "qps": {} }, { - "spec_name": "4c_32g_300db", + "spec_name": "8c_32g_400g", "cpu": { "max": 8, - "min": 4 + "min": 6 }, "mem": { "max": 32, "min": 30 }, - "device_class": [ - "S5.2XLARGE32", - "S5.4XLARGE32", - "S5t.2XLARGE32", - "SA3.2XLARGE32", - "SN3ne.2XLARGE32" - ], + "device_class": [], "storage_spec": [ { - "size": 300, + "size": 400, "type": "ALL", "mount_point": "/data" } ], - "desc": "", + "desc": "高等机型", "instance_num": 0, "qps": { "max": 0, "min": 0 } - }, + } + ], + "TwemproxyTendisSSDInstance": [ { - "spec_name": "8c_64g_400db", + "spec_name": "16c_64g_1.5tb", "cpu": { "max": 16, - "min": 8 + "min": 16 }, "mem": { - "max": 64, - "min": 61 + "max": 66, + "min": 55 }, - "device_class": [ - "S5.4XLARGE64", - "S5t.4XLARGE64", - "S5t.8XLARGE64", - "SA3.4XLARGE64", - "SN3ne.4XLARGE64" - ], + "device_class": [], "storage_spec": [ { - "size": 400, - "type": "HDD", + "size": 1500, + "type": "ALL", "mount_point": "/data" + }, + { + "size": 1500, + "type": "SSD", + "mount_point": "/data1" } ], "desc": "", "instance_num": 0, "qps": { - "max": 0, - "min": 0 + "max": 70000, + "min": 50000 } }, { - "spec_name": "16c_128g_600db", + "spec_name": "32c_128g_3.5tb", "cpu": { "max": 32, - "min": 16 + "min": 32 }, "mem": { - "max": 128, - "min": 125 + "max": 130, + "min": 110 }, - "device_class": [ - "S5.8XLARGE128" - ], + "device_class": [], "storage_spec": [ { - "size": 600, - "type": "HDD", + "size": 3500, + "type": "ALL", "mount_point": "/data" + }, + { + "size": 3500, + "type": "SSD", + "mount_point": "/data1" } ], "desc": "", "instance_num": 0, "qps": { - "max": 0, - "min": 0 + "max": 100000, + "min": 80000 } } - ] - }, - "RedisInstance": { - "tendiscache": [ + ], + "PredixyTendisplusCluster": [ { - "spec_name": "2c_4g_50gb", + "spec_name": "2c_4g_50g", "cpu": { "max": 2, "min": 2 @@ -1968,47 +1648,48 @@ "max": 4, "min": 3 }, - "device_class": [ - "S5.MEDIUM4", - "S5t.MEDIUM4", - "SA2.MEDIUM4" + "device_class": [], + "storage_spec": [ + { + "size": 50, + "type": "HDD", + "mount_point": "/data" + } ], - "storage_spec": [], "desc": "", "instance_num": 0, "qps": { - "max": 0, - "min": 0 + "max": 10000, + "min": 5000 } }, { - "spec_name": "2c_8g_100gb", + "spec_name": "2c_8g_100g", "cpu": { "max": 4, "min": 2 }, "mem": { "max": 8, - "min": 7 + "min": 6 }, - "device_class": [ - "S5.MEDIUM8", - "S5t.MEDIUM8", - "S5.LARGE8", - "S5t.LARGE8", - "SA2.LARGE8", - "SN3ne.LARGE8" + "device_class": [], + "storage_spec": [ + { + "size": 100, + "type": "HDD", + "mount_point": "/data" + } ], - "storage_spec": [], "desc": "", "instance_num": 0, "qps": { - "max": 0, - "min": 0 + "max": 15000, + "min": 10000 } }, { - "spec_name": "4c_16g_200gb", + "spec_name": "4c_16g_200g", "cpu": { "max": 6, "min": 4 @@ -2017,13 +1698,7 @@ "max": 16, "min": 15 }, - "device_class": [ - "S5.LARGE16", - "S5t.LARGE16", - "S5.2XLARGE16", - "SA2.2XLARGE16", - "SN3ne.2XLARGE16" - ], + "device_class": [], "storage_spec": [ { "size": 200, @@ -2034,12 +1709,12 @@ "desc": "", "instance_num": 0, "qps": { - "max": 0, - "min": 0 + "max": 30000, + "min": 20000 } }, { - "spec_name": "4c_32g_300db", + "spec_name": "4c_32g_300g", "cpu": { "max": 8, "min": 4 @@ -2048,13 +1723,7 @@ "max": 32, "min": 30 }, - "device_class": [ - "S5.2XLARGE32", - "S5.4XLARGE32", - "S5t.2XLARGE32", - "SN3ne.2XLARGE32", - "SA3.2XLARGE32" - ], + "device_class": [], "storage_spec": [ { "size": 300, @@ -2065,71 +1734,74 @@ "desc": "", "instance_num": 0, "qps": { - "max": 0, - "min": 0 + "max": 50000, + "min": 30000 } }, { - "spec_name": "8c_64g_400db", + "spec_name": "16c_64g_1.5tb", "cpu": { "max": 16, - "min": 8 + "min": 16 }, "mem": { - "max": 64, - "min": 61 + "max": 66, + "min": 55 }, - "device_class": [ - "S5.4XLARGE64", - "S5.8XLARGE64", - "SA3.4XLARGE64", - "SN3ne.4XLARGE64" - ], + "device_class": [], "storage_spec": [ { - "size": 400, - "type": "HDD", + "size": 1500, + "type": "ALL", "mount_point": "/data" + }, + { + "size": 1500, + "type": "SSD", + "mount_point": "/data1" } ], "desc": "", "instance_num": 0, "qps": { - "max": 0, - "min": 0 + "max": 80000, + "min": 50000 } }, { - "spec_name": "16c_128g_600gb", + "spec_name": "32c_128g_3.5tb", "cpu": { "max": 32, - "min": 16 + "min": 32 }, "mem": { - "max": 128, - "min": 125 + "max": 130, + "min": 110 }, - "device_class": [ - "S5.8XLARGE128" - ], + "device_class": [], "storage_spec": [ { - "size": 600, - "type": "HDD", + "size": 3500, + "type": "ALL", "mount_point": "/data" + }, + { + "size": 3500, + "type": "SSD", + "mount_point": "/data1" } ], "desc": "", "instance_num": 0, "qps": { - "max": 0, - "min": 0 + "max": 120000, + "min": 80000 } } ] }, "tendbcluster": { - "spider": [ + "proxy": [ { "spec_name": "通用proxy配置", "cpu": { @@ -2153,7 +1825,7 @@ "qps": {} } ], - "remote": [ + "backend": [ { "spec_name": "2核_1G_50G", "cpu": { @@ -2174,10 +1846,7 @@ ], "desc": "", "instance_num": 0, - "qps": { - "min": 10, - "max": 50 - } + "qps": {} }, { "spec_name": "4核_8G_100G", @@ -2199,10 +1868,7 @@ ], "desc": "", "instance_num": 0, - "qps": { - "min": 300, - "max": 500 - } + "qps": {} }, { "spec_name": "8核_16G_500G", @@ -2224,10 +1890,7 @@ ], "desc": "", "instance_num": 0, - "qps": { - "min": 1000, - "max": 2000 - } + "qps": {} }, { "spec_name": "16核_32G_500G", @@ -2249,10 +1912,7 @@ ], "desc": "", "instance_num": 0, - "qps": { - "min": 5000, - "max": 8000 - } + "qps": {} }, { "spec_name": "16核_32G_1000G", @@ -2274,10 +1934,7 @@ ], "desc": "", "instance_num": 0, - "qps": { - "min": 5000, - "max": 8000 - } + "qps": {} }, { "spec_name": "32核_64G_1000G", @@ -2299,10 +1956,7 @@ ], "desc": "", "instance_num": 0, - "qps": { - "min": 6000, - "max": 12000 - } + "qps": {} }, { "spec_name": "64核_128G_1000G", @@ -2324,11 +1978,155 @@ ], "desc": "", "instance_num": 0, + "qps": {} + } + ] + }, + "mongodb": { + "mongodb": [ + { + "spec_name": "2核_4G_100G", + "cpu": { + "max": 2, + "min": 2 + }, + "mem": { + "max": 4, + "min": 4 + }, + "device_class": [], + "storage_spec": [ + { + "size": 100, + "type": "ALL", + "mount_point": "/data" + } + ], + "desc": "", + "instance_num": 0, + "qps": {} + } + ], + "mongos": [ + { + "spec_name": "2核_4G_10G", + "cpu": { + "max": 4, + "min": 2 + }, + "mem": { + "max": 8, + "min": 4 + }, + "device_class": [], + "storage_spec": [ + { + "size": 10, + "type": "ALL", + "mount_point": "/data" + } + ], + "desc": "废弃", + "instance_num": 0, + "qps": {} + }, + { + "spec_name": "2核_4G_100G", + "cpu": { + "max": 2, + "min": 2 + }, + "mem": { + "max": 4, + "min": 4 + }, + "device_class": [], + "storage_spec": [ + { + "size": 100, + "type": "HDD", + "mount_point": "/data" + } + ], + "desc": "", + "instance_num": 0, "qps": { - "min": 10000, - "max": 15000 + "max": 0, + "min": 0 } } + ], + "mongo_config": [ + { + "spec_name": "2核_4G_100G", + "cpu": { + "max": 2, + "min": 2 + }, + "mem": { + "max": 4, + "min": 4 + }, + "device_class": [], + "storage_spec": [ + { + "size": 100, + "type": "ALL", + "mount_point": "/data" + } + ], + "desc": "", + "instance_num": 0, + "qps": {} + } + ] + }, + "sqlserver": { + "sqlserver": [ + { + "spec_name": "2核_4G_10G", + "cpu": { + "max": 4, + "min": 2 + }, + "mem": { + "max": 8, + "min": 4 + }, + "device_class": [], + "storage_spec": [ + { + "size": 10, + "type": "ALL", + "mount_point": "/data" + } + ], + "desc": "", + "instance_num": 0, + "qps": {} + }, + { + "spec_name": "2核_4G_10G", + "cpu": { + "max": 4, + "min": 2 + }, + "mem": { + "max": 8, + "min": 4 + }, + "device_class": [], + "storage_spec": [ + { + "size": 10, + "type": "ALL", + "mount_point": "/data" + } + ], + "desc": "", + "instance_num": 0, + "qps": {} + } ] } } \ No newline at end of file diff --git a/dbm-ui/backend/db_meta/migrations/0043_auto_20241014_1042.py b/dbm-ui/backend/db_meta/migrations/0043_auto_20241014_1042.py new file mode 100644 index 0000000000..62e989f760 --- /dev/null +++ b/dbm-ui/backend/db_meta/migrations/0043_auto_20241014_1042.py @@ -0,0 +1,56 @@ +# Generated by Django 3.2.25 on 2024-10-14 02:42 + +from django.db import migrations, models + +from backend.db_meta.enums.spec import SpecClusterType, SpecMachineType + + +class Migration(migrations.Migration): + + dependencies = [ + ("db_meta", "0042_auto_20240903_1138"), + ] + + operations = [ + migrations.AlterModelOptions( + name="bksubzone", + options={"verbose_name": "蓝鲸园区表(BKSubzone)", "verbose_name_plural": "蓝鲸园区表(BKSubzone)"}, + ), + migrations.AlterField( + model_name="spec", + name="cpu", + field=models.JSONField(default=dict, help_text='cpu规格描述:{"min":1,"max":10}'), + ), + migrations.AlterField( + model_name="spec", + name="device_class", + field=models.JSONField(default=dict, help_text='实际机器机型: ["class1","class2"]'), + ), + migrations.AlterField( + model_name="spec", + name="mem", + field=models.JSONField(default=dict, help_text='mem规格描述:{"min":100,"max":1000}'), + ), + migrations.AlterField( + model_name="spec", + name="qps", + field=models.JSONField(default=dict, help_text='qps规格描述:{"min": 1, "max": 100}'), + ), + migrations.AlterField( + model_name="spec", + name="spec_cluster_type", + field=models.CharField(choices=SpecClusterType.get_choices(), help_text="组件类型", max_length=64), + ), + migrations.AlterField( + model_name="spec", + name="spec_machine_type", + field=models.CharField(choices=SpecMachineType.get_choices(), help_text="机器类型", max_length=64), + ), + migrations.AlterField( + model_name="spec", + name="storage_spec", + field=models.JSONField( + default=dict, help_text='存储磁盘需求配置:[{"mount_point":"/data","size":500,"type":"ssd"}]' + ), + ), + ] diff --git a/dbm-ui/backend/db_meta/models/spec.py b/dbm-ui/backend/db_meta/models/spec.py index 5262a2e0d3..a264e5edea 100644 --- a/dbm-ui/backend/db_meta/models/spec.py +++ b/dbm-ui/backend/db_meta/models/spec.py @@ -21,7 +21,7 @@ from backend.configuration.constants import AffinityEnum, SystemSettingsEnum from backend.configuration.models import SystemSettings from backend.constants import INT_MAX -from backend.db_meta.enums import ClusterType, MachineType +from backend.db_meta.enums.spec import SpecClusterType, SpecMachineType logger = logging.getLogger("root") @@ -33,15 +33,13 @@ class Spec(AuditedModel): spec_id = models.AutoField(primary_key=True) spec_name = models.CharField(max_length=128, help_text=_("虚拟规格名称")) - spec_cluster_type = models.CharField( - max_length=64, choices=ClusterType.get_choices(), help_text=_("集群类型:MySQL、Proxy、Spider") - ) - spec_machine_type = models.CharField(max_length=64, choices=MachineType.get_choices(), help_text=_("机器规格类型")) - cpu = models.JSONField(null=True, help_text=_('cpu规格描述:{"min":1,"max":10}')) - mem = models.JSONField(null=True, help_text=_('mem规格描述:{"min":100,"max":1000}')) - device_class = models.JSONField(null=True, help_text=_('实际机器机型: ["class1","class2"]')) + spec_cluster_type = models.CharField(max_length=64, choices=SpecClusterType.get_choices(), help_text=_("组件类型")) + spec_machine_type = models.CharField(max_length=64, choices=SpecMachineType.get_choices(), help_text=_("机器类型")) + cpu = models.JSONField(help_text=_('cpu规格描述:{"min":1,"max":10}'), default=dict) + mem = models.JSONField(help_text=_('mem规格描述:{"min":100,"max":1000}'), default=dict) + device_class = models.JSONField(help_text=_('实际机器机型: ["class1","class2"]'), default=dict) storage_spec = models.JSONField( - null=True, help_text=_('存储磁盘需求配置:[{"mount_point":"/data","size":500,"type":"ssd"}]') + help_text=_('存储磁盘需求配置:[{"mount_point":"/data","size":500,"type":"ssd"}]'), default=dict ) desc = models.TextField(help_text=_("资源规格描述"), null=True, blank=True) enable = models.BooleanField(help_text=_("是否启用"), default=True) @@ -64,21 +62,17 @@ def capacity(self): 默认:磁盘总容量 """ mount_point__size: Dict[str, int] = {disk["mount_point"]: disk["size"] for disk in self.storage_spec} - if self.spec_cluster_type == ClusterType.TenDBCluster: + if self.spec_cluster_type == SpecClusterType.TenDBCluster: return mount_point__size.get("/data1") or mount_point__size["/data"] / 2 - if self.spec_cluster_type in [ - ClusterType.TwemproxyTendisSSDInstance, - ClusterType.TendisPredixyTendisplusCluster, - ClusterType.MongoShardedCluster, + if self.spec_machine_type in [ + SpecMachineType.TwemproxyTendisSSDInstance, + SpecMachineType.TendisPredixyTendisplusCluster, + SpecMachineType.MONGODB, ]: return mount_point__size.get("/data1") or mount_point__size["/data"] / 2 - if self.spec_cluster_type in [ - ClusterType.TendisTwemproxyRedisInstance, - ClusterType.RedisInstance, - ClusterType.TendisPredixyRedisCluster, - ]: + if self.spec_machine_type in [SpecMachineType.TendisTwemproxyRedisInstance]: # 取规格内存平均值 return (self.mem["min"] + self.mem["max"]) / 2 diff --git a/dbm-ui/backend/db_services/dbresource/constants.py b/dbm-ui/backend/db_services/dbresource/constants.py index 7f08b032b6..d6c6987a6d 100644 --- a/dbm-ui/backend/db_services/dbresource/constants.py +++ b/dbm-ui/backend/db_services/dbresource/constants.py @@ -11,7 +11,7 @@ from django.utils.translation import ugettext_lazy as _ -from backend.db_meta.enums import ClusterType +from backend.db_meta.enums.spec import SpecClusterType, SpecMachineType from backend.db_services.dbresource.handlers import ( MongoDBShardSpecFilter, RedisClusterSpecFilter, @@ -31,14 +31,15 @@ GSE_AGENT_RUNNING_CODE = 2 # 集群对应的规格筛选类 -CLUSTER_TYPE__SPEC_FILTER = { - ClusterType.TenDBCluster: TenDBClusterSpecFilter, - ClusterType.TendisPredixyRedisCluster: RedisClusterSpecFilter, - ClusterType.TendisPredixyTendisplusCluster: TendisPlusSpecFilter, - ClusterType.TendisTwemproxyRedisInstance: TendisCacheSpecFilter, - ClusterType.TwemproxyTendisSSDInstance: TendisSSDSpecFilter, - ClusterType.MongoShardedCluster: MongoDBShardSpecFilter, - ClusterType.MongoReplicaSet: MongoDBShardSpecFilter, +SPEC_FILTER_FACTORY = { + SpecClusterType.TenDBCluster: {SpecMachineType.BACKEND: TenDBClusterSpecFilter}, + SpecClusterType.Redis: { + SpecMachineType.TendisPredixyRedisCluster: RedisClusterSpecFilter, + SpecMachineType.TendisPredixyTendisplusCluster: TendisPlusSpecFilter, + SpecMachineType.TendisTwemproxyRedisInstance: TendisCacheSpecFilter, + SpecMachineType.TwemproxyTendisSSDInstance: TendisSSDSpecFilter, + }, + SpecClusterType.MongoDB: {SpecMachineType.MONGODB: MongoDBShardSpecFilter}, } diff --git a/dbm-ui/backend/db_services/dbresource/filters.py b/dbm-ui/backend/db_services/dbresource/filters.py index 8ae66e9356..4e0316a128 100644 --- a/dbm-ui/backend/db_services/dbresource/filters.py +++ b/dbm-ui/backend/db_services/dbresource/filters.py @@ -12,7 +12,6 @@ from django.utils.translation import ugettext_lazy as _ from django_filters import rest_framework as filters -from backend.db_meta.enums import ClusterType from backend.db_meta.models.spec import Spec @@ -31,8 +30,7 @@ def filter_update_at(self, queryset, name, value): return queryset.order_by(time_field) def filter_spec_db_type(self, queryset, name, value): - cluster_types = ClusterType.db_type_to_cluster_types(value) - return queryset.filter(spec_cluster_type__in=cluster_types) + return queryset.filter(spec_cluster_type=value) def filter_spec_ids(self, queryset, name, value): ids = value.split(",") diff --git a/dbm-ui/backend/db_services/dbresource/handlers.py b/dbm-ui/backend/db_services/dbresource/handlers.py index d3ce8de607..3303bf5f1f 100644 --- a/dbm-ui/backend/db_services/dbresource/handlers.py +++ b/dbm-ui/backend/db_services/dbresource/handlers.py @@ -16,9 +16,8 @@ from django.utils.translation import ugettext as _ from backend.components.dbresource.client import DBResourceApi -from backend.db_meta.enums import ClusterType, MachineType +from backend.db_meta.enums.spec import SpecClusterType, SpecMachineType from backend.db_meta.models import Spec -from backend.db_services.dbresource.enmus import DeployPlanChangeType from backend.db_services.dbresource.exceptions import SpecOperateException @@ -38,32 +37,12 @@ def __init__( { **model_to_dict(spec), "capacity": spec.capacity, - "change_type": DeployPlanChangeType.replace_change.value, } for spec in Spec.objects.filter( spec_machine_type=spec_machine_type, spec_cluster_type=spec_cluster_type, enable=True ) ] - if ( - spec_cluster_type - in [ClusterType.TendisPredixyRedisCluster.value, ClusterType.TendisPredixyTendisplusCluster.value] - and old_spec_id != 0 - ): - spec_old = Spec.objects.get( - spec_machine_type=spec_machine_type, - spec_cluster_type=spec_cluster_type, - enable=True, - spec_id=old_spec_id, - ) - self.specs.append( - { - **model_to_dict(spec_old), - "capacity": spec_old.capacity, - "change_type": DeployPlanChangeType.inplace_change.value, - } - ) - def calc_machine_pair(self): """计算每种规格所需的机器组数和集群总容量: 目标容量 / 规格容量""" for spec in self.specs: @@ -259,7 +238,6 @@ def calc_cluster_shard_num(self): avaiable_specs.append(self.specs[spec_cnt - 2]) for spec_new in avaiable_specs: - # 一定要保证集群总分片数是机器组数的整数倍, cluster_shard_num = math.ceil(max_capcity / instance_cap) single_machine_shard_num = math.ceil(cluster_shard_num / spec_new["machine_pair"]) @@ -352,11 +330,8 @@ class MongoDBShardSpecFilter(object): """mongodb集群的部署方案""" def __init__(self, capacity, spec_cluster_type, spec_machine_type, **kwargs): - if ( - spec_cluster_type not in [ClusterType.MongoShardedCluster, ClusterType.MongoReplicaSet] - or spec_machine_type != MachineType.MONGODB - ): - raise SpecOperateException(_("请保证输入的集群类型是{},且机器规格为mongodb").format(spec_cluster_type)) + if spec_cluster_type != SpecClusterType.MongoDB or spec_machine_type != SpecMachineType.MONGODB: + raise SpecOperateException(_("请保证输入的集群类型是Mongodb,且机器规格为mongodb")) self.specs: List[Dict[str, Any]] = [] mongodb_specs = Spec.objects.filter( @@ -418,7 +393,7 @@ def spec_resource_count(cls, bk_biz_id: int, bk_cloud_id: int, spec_ids: List[in spec_cluster_type = list(set(specs.values_list("spec_cluster_type", flat=True))) if len(spec_cluster_type) > 1: raise SpecOperateException(_("请保证请求的规格类型一致")) - resource_type = ClusterType.cluster_type_to_db_type(spec_cluster_type[0]) + resource_type = spec_cluster_type[0] # 构造申请参数 spec_count_details = [ spec.get_group_apply_params(group_mark=str(spec.spec_id), count=1, group_count=1, bk_cloud_id=bk_cloud_id) diff --git a/dbm-ui/backend/db_services/dbresource/mock.py b/dbm-ui/backend/db_services/dbresource/mock.py index 09972e6736..4333cbf0e6 100644 --- a/dbm-ui/backend/db_services/dbresource/mock.py +++ b/dbm-ui/backend/db_services/dbresource/mock.py @@ -110,3 +110,24 @@ "sub_zone_detail": {"上海-宝信": 1}, }, ] + +DEVICE_CLASS_DATA = { + "count": 1, + "results": [ + { + "require_type": 1, + "region": "ap-nanjing", + "zone": "ap-nanjing-1", + "device_type": "xxxxxx", + "cpu": 10, + "mem": 100, + "disk": 100, + "remark": "", + "label": {"device_group": "标准型", "device_size": "大核心"}, + "capacity_flag": 0, + "enable_apply": False, + "score": 0, + "comment": "xxxx", + } + ], +} diff --git a/dbm-ui/backend/db_services/dbresource/serializers.py b/dbm-ui/backend/db_services/dbresource/serializers.py index 5f2d688686..54ab5b90d3 100644 --- a/dbm-ui/backend/db_services/dbresource/serializers.py +++ b/dbm-ui/backend/db_services/dbresource/serializers.py @@ -15,7 +15,8 @@ from backend import env from backend.constants import INT_MAX -from backend.db_meta.enums import ClusterType, InstanceRole, MachineType +from backend.db_meta.enums import InstanceRole +from backend.db_meta.enums.spec import SpecClusterType, SpecMachineType from backend.db_meta.models import Spec from backend.db_services.dbresource import mock from backend.db_services.dbresource.constants import ResourceGroupByEnum, ResourceOperation @@ -248,10 +249,10 @@ class ResourceSummarySerializer(serializers.Serializer): # 聚合过滤字段 db_type = serializers.CharField(help_text=_("db类型")) machine_type = serializers.ChoiceField( - help_text=_("机器类型"), choices=MachineType.get_choices(), required=False, default="" + help_text=_("机器类型"), choices=SpecMachineType.get_choices(), required=False, default="" ) cluster_type = serializers.ChoiceField( - help_text=_("集群类型"), choices=ClusterType.get_choices(), required=False, default="" + help_text=_("集群类型"), choices=SpecClusterType.get_choices(), required=False, default="" ) spec_id_list = serializers.CharField(help_text=_("规格ID"), required=False, default="") @@ -286,10 +287,16 @@ class Meta: swagger_schema_fields = {"example": SPEC_DATA} def get_spec_db_type(self, obj): - db_type = ClusterType.cluster_type_to_db_type(obj.spec_cluster_type) + db_type = obj.spec_cluster_type return db_type def validate_valid_cpu_mem(self, attrs): + # 校验cpu,mem的值是int + try: + attrs["cpu"]["min"], attrs["cpu"]["max"] = int(attrs["cpu"]["min"]), int(attrs["cpu"]["max"]) + attrs["mem"]["min"], attrs["mem"]["max"] = float(attrs["mem"]["min"]), float(attrs["mem"]["max"]) + except ValueError: + raise serializers.ValidationError(_("请保证CPU/MEM的取值为数字")) # 校验cpu, mem是正确的范围 if attrs["cpu"]["min"] > attrs["cpu"]["max"] or attrs["mem"]["min"] > attrs["mem"]["max"]: raise serializers.ValidationError(_("请保证CPU/MEM的最小最大范围合理")) @@ -324,18 +331,20 @@ def validate_data_points(self, attrs): standard_mount_points = ["/data", "/data1"] mount_points = [storage["mount_point"] for storage in attrs["storage_spec"]] # TenDBCluster 磁盘录入只能是/data or /data和/data1 - if attrs["spec_cluster_type"] == ClusterType.TenDBCluster and attrs["spec_machine_type"] == MachineType.REMOTE: + if ( + attrs["spec_cluster_type"] == SpecClusterType.TenDBCluster + and attrs["spec_machine_type"] == SpecMachineType.BACKEND + ): if not ("/data" in mount_points and set(mount_points).issubset(standard_mount_points)): raise serializers.ValidationError( _("【{}】后端磁盘挂载点必须包含/data,可选/data1").format(attrs["spec_cluster_type"]) ) # TendisPlus/TendisSSD 磁盘必须包含/data,/data1可选 - if attrs["spec_cluster_type"] in [ - ClusterType.TwemproxyTendisSSDInstance, - ClusterType.TendisPredixyTendisplusCluster, - ] and attrs["spec_machine_type"] in [MachineType.TENDISPLUS, MachineType.TENDISSSD]: - if "/data" not in set(mount_points): - raise serializers.ValidationError(_("【{}】后端磁盘挂载点必须包含/data").format(attrs["spec_cluster_type"])) + if attrs["spec_machine_type"] in [ + SpecMachineType.TwemproxyTendisSSDInstance, + SpecMachineType.TendisPredixyTendisplusCluster, + ] and "/data" not in set(mount_points): + raise serializers.ValidationError(_("【{}】后端磁盘挂载点必须包含/data").format(attrs["spec_machine_type"])) def validate(self, attrs): self.validate_valid_cpu_mem(attrs) @@ -357,8 +366,8 @@ class SpecEnableDisableSerializer(serializers.Serializer): class VerifyDuplicatedSpecNameSerializer(serializers.Serializer): - spec_cluster_type = serializers.ChoiceField(help_text=_("集群类型"), choices=ClusterType.get_choices()) - spec_machine_type = serializers.ChoiceField(help_text=_("机器类型"), choices=MachineType.get_choices()) + spec_cluster_type = serializers.ChoiceField(help_text=_("集群类型"), choices=SpecClusterType.get_choices()) + spec_machine_type = serializers.ChoiceField(help_text=_("机器类型"), choices=SpecMachineType.get_choices()) spec_name = serializers.CharField(help_text=_("规格名称")) spec_id = serializers.IntegerField(help_text=_("规格ID(更新时传递)"), required=False) @@ -379,8 +388,8 @@ class Meta: class QueryQPSRangeSerializer(serializers.Serializer): - spec_cluster_type = serializers.ChoiceField(help_text=_("集群类型"), choices=ClusterType.get_choices()) - spec_machine_type = serializers.ChoiceField(help_text=_("角色类型"), choices=MachineType.get_choices()) + spec_cluster_type = serializers.ChoiceField(help_text=_("集群类型"), choices=SpecClusterType.get_choices()) + spec_machine_type = serializers.ChoiceField(help_text=_("角色类型"), choices=SpecMachineType.get_choices()) capacity = serializers.FloatField(help_text=_("当前容量需求")) future_capacity = serializers.IntegerField(help_text=_("未来容量需求"), required=False) shard_num = serializers.IntegerField(help_text=_("所需分片数"), required=False, default=0) @@ -420,3 +429,14 @@ class SpecCountResourceSerializer(serializers.Serializer): class SpecCountResourceResponseSerializer(serializers.Serializer): class Meta: swagger_schema_fields = {"example": {"spec1": 10, "spec2": 10}} + + +class ListCvmDeviceClassSerializer(serializers.Serializer): + offset = serializers.IntegerField(help_text=_("起始位置"), required=False, default=0) + limit = serializers.IntegerField(help_text=_("分页限制"), required=False, default=10, max_value=200) + name = serializers.CharField(help_text=_("名称"), required=False, default="", allow_null=True, allow_blank=True) + + +class ListCvmDeviceClassResponseSerializer(serializers.Serializer): + class Meta: + swagger_schema_fields = {"example": mock.DEVICE_CLASS_DATA} diff --git a/dbm-ui/backend/db_services/dbresource/views/resource.py b/dbm-ui/backend/db_services/dbresource/views/resource.py index d9ed0569c2..795adb135b 100644 --- a/dbm-ui/backend/db_services/dbresource/views/resource.py +++ b/dbm-ui/backend/db_services/dbresource/views/resource.py @@ -23,6 +23,7 @@ from backend.bk_web.swagger import common_swagger_auto_schema from backend.components import CCApi from backend.components.dbresource.client import DBResourceApi +from backend.components.hcm.client import HCMApi from backend.configuration.constants import SystemSettingsEnum from backend.configuration.models import SystemSettings from backend.db_meta.models import AppCache @@ -36,6 +37,8 @@ from backend.db_services.dbresource.serializers import ( GetDiskTypeResponseSerializer, GetMountPointResponseSerializer, + ListCvmDeviceClassResponseSerializer, + ListCvmDeviceClassSerializer, ListDBAHostsSerializer, ListSubzonesSerializer, QueryDBAHostsSerializer, @@ -58,6 +61,7 @@ from backend.db_services.ipchooser.handlers.topo_handler import TopoHandler from backend.db_services.ipchooser.query.resource import ResourceQueryHelper from backend.db_services.ipchooser.types import ScopeList +from backend.exceptions import ApiRequestError from backend.flow.consts import FAILED_STATES, SUCCEED_STATES from backend.flow.engine.controller.base import BaseController from backend.flow.models import FlowTree @@ -306,11 +310,26 @@ def get_subzones(self, request): @common_swagger_auto_schema( operation_summary=_("获取机型列表"), + request_body=ListCvmDeviceClassSerializer(), + responses={status.HTTP_200_OK: ListCvmDeviceClassResponseSerializer()}, tags=[SWAGGER_TAG], ) - @action(detail=False, methods=["GET"]) + @action(detail=False, methods=["POST"], serializer_class=ListCvmDeviceClassSerializer) def get_device_class(self, request): - return Response(DBResourceApi.get_device_class()) + data = self.params_validate(self.get_serializer_class()) + page = {"start": data["offset"], "limit": data["limit"]} + # 默认过滤条件是支持申请的机型 + dvc_filter = {"condition": "AND", "rules": [{"field": "enable_apply", "operator": "equal", "value": True}]} + if data.get("name"): + dvc_filter["rules"].append({"field": "device_type", "operator": "contains", "value": data["name"]}) + # 请求hcm平台获取机型列表,若报错则忽略 + try: + device_list = HCMApi.list_cvm_device(params={"filter": dvc_filter, "page": page}) + device_list["results"] = device_list.pop("info") + except (Exception, ApiRequestError): + device_list = {"count": 0, "results": []} + + return Response(device_list) @common_swagger_auto_schema( operation_summary=_("资源预申请"), diff --git a/dbm-ui/backend/db_services/dbresource/views/sepc.py b/dbm-ui/backend/db_services/dbresource/views/sepc.py index aaafc21b3a..7a1c6ac44a 100644 --- a/dbm-ui/backend/db_services/dbresource/views/sepc.py +++ b/dbm-ui/backend/db_services/dbresource/views/sepc.py @@ -20,10 +20,10 @@ from backend.bk_web.models import AuditedModel from backend.bk_web.pagination import AuditedLimitOffsetPagination from backend.bk_web.swagger import common_swagger_auto_schema -from backend.db_meta.enums import ClusterType, InstanceRole, MachineType +from backend.db_meta.enums import InstanceRole, MachineType from backend.db_meta.models import Cluster, Machine, ProxyInstance, StorageInstance from backend.db_meta.models.spec import Spec -from backend.db_services.dbresource.constants import CLUSTER_TYPE__SPEC_FILTER, SWAGGER_TAG +from backend.db_services.dbresource.constants import SPEC_FILTER_FACTORY, SWAGGER_TAG from backend.db_services.dbresource.exceptions import SpecFilterClassDoesNotExistException, SpecOperateException from backend.db_services.dbresource.filters import SpecListFilter from backend.db_services.dbresource.serializers import ( @@ -74,14 +74,13 @@ def get_default_permission_class(self): @staticmethod def instance_getter(request, view): # 如果是单个操作 - convert = ClusterType.cluster_type_to_db_type if view.kwargs.get("pk"): - return [convert(Spec.objects.get(spec_id=view.kwargs["pk"]).spec_cluster_type)] + return [Spec.objects.get(spec_id=view.kwargs["pk"]).spec_cluster_type] elif request.data.get("spec_ids"): specs = Spec.objects.filter(pk__in=request.data["spec_ids"]) - return list(set([convert(spec.spec_cluster_type) for spec in specs])) + return list(set([spec.spec_cluster_type for spec in specs])) elif request.data.get("spec_cluster_type"): - return [convert(request.data["spec_cluster_type"])] + return [request.data["spec_cluster_type"]] return [] def _remove_spec_fields(self, machine_type, data): @@ -156,7 +155,7 @@ def modify_spec_enable_status(self, request, *args, **kwargs): tags=[SWAGGER_TAG], ) @Permission.decorator_external_permission_field( - param_field=lambda d: ClusterType.cluster_type_to_db_type(d["spec_cluster_type"]), + param_field=lambda d: d["spec_cluster_type"], actions=[ActionEnum.SPEC_CREATE, ActionEnum.SPEC_DESTROY, ActionEnum.SPEC_UPDATE], resource_meta=ResourceEnum.DBTYPE, ) @@ -307,9 +306,12 @@ def query_qps_range(self, request, *args, **kwargs): ) def filter_cluster_spec(self, request, *args, **kwargs): data = self.params_validate(self.get_serializer_class()) + spec_cluster_type, spec_machine_type = data["spec_cluster_type"], data["spec_machine_type"] try: - specs = CLUSTER_TYPE__SPEC_FILTER[data["spec_cluster_type"]](**data).get_target_specs() + specs = SPEC_FILTER_FACTORY[spec_cluster_type][spec_machine_type](**data).get_target_specs() except KeyError: - raise SpecFilterClassDoesNotExistException(_("集群:{}的规格筛选类不存在,请实现相应接口").format(data["spec_cluster_type"])) + raise SpecFilterClassDoesNotExistException( + _("集群:{}-{}的规格筛选类不存在,请实现相应接口").format(spec_cluster_type, spec_machine_type) + ) return Response(specs) diff --git a/dbm-ui/backend/db_services/mysql/resources/tendbcluster/query.py b/dbm-ui/backend/db_services/mysql/resources/tendbcluster/query.py index 3d17560635..d7461be0d1 100644 --- a/dbm-ui/backend/db_services/mysql/resources/tendbcluster/query.py +++ b/dbm-ui/backend/db_services/mysql/resources/tendbcluster/query.py @@ -19,6 +19,7 @@ from backend.db_meta.api.cluster.tendbcluster.detail import scan_cluster from backend.db_meta.enums import InstanceInnerRole, TenDBClusterSpiderRole from backend.db_meta.enums.cluster_type import ClusterType +from backend.db_meta.enums.spec import SpecClusterType from backend.db_meta.exceptions import DBMetaException from backend.db_meta.models import AppCache, Spec from backend.db_meta.models.cluster import Cluster @@ -86,7 +87,7 @@ def _filter_cluster_hook( proxy_queryset = proxy_queryset.prefetch_related("tendbclusterspiderext") # 预取remote的spec remote_spec_map = { - spec.spec_id: spec for spec in Spec.objects.filter(spec_cluster_type=ClusterType.TenDBCluster) + spec.spec_id: spec for spec in Spec.objects.filter(spec_cluster_type=SpecClusterType.TenDBCluster) } return super()._filter_cluster_hook( bk_biz_id, diff --git a/dbm-ui/backend/db_services/mysql/resources/tendbcluster/yasg_slz.py b/dbm-ui/backend/db_services/mysql/resources/tendbcluster/yasg_slz.py index f7fd22d87d..f359daf13a 100644 --- a/dbm-ui/backend/db_services/mysql/resources/tendbcluster/yasg_slz.py +++ b/dbm-ui/backend/db_services/mysql/resources/tendbcluster/yasg_slz.py @@ -33,7 +33,7 @@ "updater": "admin", "spec_id": 3, "spec_name": "test_msql", - "spec_cluster_type": "tendbsingle", + "spec_cluster_type": "mysql", "spec_machine_type": "single", "cpu": {"max": "12", "min": "12"}, "mem": {"max": "2", "min": "1"}, diff --git a/dbm-ui/backend/db_services/redis/resources/redis_cluster/query.py b/dbm-ui/backend/db_services/redis/resources/redis_cluster/query.py index 739149d1b0..ea53fa100c 100644 --- a/dbm-ui/backend/db_services/redis/resources/redis_cluster/query.py +++ b/dbm-ui/backend/db_services/redis/resources/redis_cluster/query.py @@ -15,7 +15,6 @@ from django.forms import model_to_dict from django.utils.translation import ugettext_lazy as _ -from backend.configuration.constants import DBType from backend.db_meta.api.cluster.rediscluster.handler import RedisClusterHandler from backend.db_meta.api.cluster.redisinstance.handler import RedisInstanceHandler from backend.db_meta.api.cluster.tendiscache.handler import TendisCacheClusterHandler @@ -23,6 +22,7 @@ from backend.db_meta.api.cluster.tendisssd.handler import TendisSSDClusterHandler from backend.db_meta.enums import ClusterEntryType, InstanceRole from backend.db_meta.enums.cluster_type import ClusterType +from backend.db_meta.enums.spec import SpecClusterType from backend.db_meta.models import AppCache, Machine, Spec from backend.db_meta.models.cluster import Cluster from backend.db_services.dbbase.resources import query @@ -105,8 +105,7 @@ def _filter_cluster_hook( **kwargs, ) -> ResourceList: # 预取remote的spec - redis_types = ClusterType.db_type_to_cluster_types(DBType.Redis) - redis_spec_map = {spec.spec_id: spec for spec in Spec.objects.filter(spec_cluster_type__in=redis_types)} + redis_spec_map = {spec.spec_id: spec for spec in Spec.objects.filter(spec_cluster_type=SpecClusterType.Redis)} return super()._filter_cluster_hook( bk_biz_id, cluster_queryset, diff --git a/dbm-ui/backend/env/apigw_domains.py b/dbm-ui/backend/env/apigw_domains.py index eab42953b0..151afab007 100644 --- a/dbm-ui/backend/env/apigw_domains.py +++ b/dbm-ui/backend/env/apigw_domains.py @@ -27,6 +27,7 @@ DRS_APIGW_DOMAIN = get_type_env(key="DRS_APIGW_DOMAIN", _type=str) NAMESERVICE_APIGW_DOMAIN = get_type_env(key="NAMESERVICE_APIGW_DOMAIN", _type=str) +HCM_APIGW_DOMAIN = get_type_env(key="HCM_APIGW_DOMAIN", _type=str) DBCONFIG_APIGW_DOMAIN = get_type_env(key="DBCONFIG_APIGW_DOMAIN", _type=str, default="http://bk-dbm-dbconfig") DNS_APIGW_DOMAIN = get_type_env(key="DNS_APIGW_DOMAIN", _type=str, default="http://bk-dbm-db-dns-api") diff --git a/dbm-ui/backend/tests/mock_data/ticket/doris_flow.py b/dbm-ui/backend/tests/mock_data/ticket/doris_flow.py index ab9488bd86..ddff9e684f 100644 --- a/dbm-ui/backend/tests/mock_data/ticket/doris_flow.py +++ b/dbm-ui/backend/tests/mock_data/ticket/doris_flow.py @@ -11,6 +11,7 @@ from backend.db_meta.enums.cluster_type import ClusterType from backend.db_meta.enums.machine_type import MachineType +from backend.db_meta.enums.spec import SpecClusterType from backend.tests.mock_data import constant from backend.ticket.constants import TicketType @@ -249,7 +250,7 @@ "cpu": {"max": 256, "min": 2}, "mem": {"max": 256, "min": 2}, "storage_spec": [{"size": 30, "type": "ALL", "mount_point": "/data"}], - "spec_cluster_type": ClusterType.Doris.value, + "spec_cluster_type": SpecClusterType.Doris.value, "spec_machine_type": MachineType.DORIS_FOLLOWER.value, "device_class": [-1], "qps": {"max": 0, "min": 0}, @@ -261,7 +262,7 @@ "cpu": {"max": 256, "min": 2}, "mem": {"max": 256, "min": 2}, "storage_spec": [{"size": 30, "type": "ALL", "mount_point": "/data"}], - "spec_cluster_type": ClusterType.Doris.value, + "spec_cluster_type": SpecClusterType.Doris.value, "spec_machine_type": MachineType.DORIS_OBSERVER.value, "device_class": [-1], "qps": {"max": 0, "min": 0}, @@ -273,7 +274,7 @@ "cpu": {"max": 256, "min": 2}, "mem": {"max": 256, "min": 2}, "storage_spec": [{"size": 30, "type": "ALL", "mount_point": "/data"}], - "spec_cluster_type": ClusterType.Doris.value, + "spec_cluster_type": SpecClusterType.Doris.value, "spec_machine_type": MachineType.DORIS_BACKEND.value, "device_class": [-1], "qps": {"max": 0, "min": 0}, diff --git a/dbm-ui/backend/tests/mock_data/ticket/mongodb_flow.py b/dbm-ui/backend/tests/mock_data/ticket/mongodb_flow.py index 38d9e460db..b4d7cc0b14 100644 --- a/dbm-ui/backend/tests/mock_data/ticket/mongodb_flow.py +++ b/dbm-ui/backend/tests/mock_data/ticket/mongodb_flow.py @@ -11,6 +11,7 @@ from backend.db_meta.enums.cluster_type import ClusterType +from backend.db_meta.enums.spec import SpecClusterType from backend.ticket.constants import TicketType BK_USERNAME = "admin" @@ -217,7 +218,7 @@ "cpu": {"max": 256, "min": 1}, "mem": {"max": 256, "min": 1}, "storage_spec": [{"size": 10, "type": "ALL", "mount_point": "/data"}], - "spec_cluster_type": ClusterType.MongoShardedCluster, + "spec_cluster_type": SpecClusterType.MongoDB, "spec_machine_type": "mongos", "qps": {"max": 0, "min": 0}, "enable": 1, @@ -228,7 +229,7 @@ "cpu": {"max": 256, "min": 1}, "mem": {"max": 256, "min": 1}, "storage_spec": [{"size": 10, "type": "ALL", "mount_point": "/data"}], - "spec_cluster_type": ClusterType.MongoShardedCluster, + "spec_cluster_type": SpecClusterType.MongoDB, "spec_machine_type": "mongos", "qps": {"max": 0, "min": 0}, "enable": 1, @@ -239,7 +240,7 @@ "cpu": {"max": 256, "min": 1}, "mem": {"max": 256, "min": 1}, "storage_spec": [{"size": 10, "type": "ALL", "mount_point": "/data"}], - "spec_cluster_type": ClusterType.MongoShardedCluster, + "spec_cluster_type": SpecClusterType.MongoDB, "spec_machine_type": "mongos", "qps": {"max": 0, "min": 0}, "enable": 1,