forked from TencentBlueKing/blueking-dbm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dbm-services): 动态加载mysql pod 启动参数 TencentBlueKing#8218
- Loading branch information
Showing
5 changed files
with
118 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
10 changes: 10 additions & 0 deletions
10
dbm-services/mysql/db-simulation/assets/migrations/000004_add_pod_start_args_table.up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
CREATE TABLE IF NOT EXISTS `tb_mysql_pod_start_cfgs` ( | ||
`id` int(11) NOT NULL AUTO_INCREMENT, | ||
`component_type` varchar(64) NOT NULL, | ||
`version` varchar(64) NOT NULL, | ||
`start_args` varchar(1024) NOT NULL, | ||
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
PRIMARY KEY (`id`), | ||
UNIQUE KEY `uk_cv` (`component_type`, `version`) | ||
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4; |
31 changes: 31 additions & 0 deletions
31
dbm-services/mysql/db-simulation/model/tb_mysql_pod_start_cfg.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
package model | ||
|
||
import "time" | ||
|
||
// TbMySQLPodStartCfg 模拟执行 pod 启动参数 | ||
type TbMySQLPodStartCfg struct { | ||
ID int `gorm:"primaryKey;column:id;type:int(11);not null" json:"-"` | ||
ComponentType string `gorm:"unique;column:uk_cv;type:varchar(64);not null" json:"component_type"` | ||
Version string `gorm:"unique;column:uk_cv;type:varchar(64);not null" json:"version"` | ||
StartArgs string `gorm:"column:start_args;type:varchar(1024);not null" json:"start_args"` | ||
UpdateTime time.Time `gorm:"column:update_time;type:timestamp;default:CURRENT_TIMESTAMP()" json:"update_time"` | ||
CreateTime time.Time `gorm:"column:create_time;type:timestamp;default:CURRENT_TIMESTAMP()" json:"create_time"` | ||
} | ||
|
||
// GetStartArsg pod 启动参数 | ||
func GetStartArsg(componentType, version string) (start_args string, err error) { | ||
err = DB.Model(&TbSimulationImgCfg{}).Select("start_args").Where("component_type = ? AND version = ?", componentType, | ||
version). | ||
First(&start_args).Error | ||
return | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters