Skip to content

Commit

Permalink
fix(redis): redis忽略传入MaxMemory TencentBlueKing#8507
Browse files Browse the repository at this point in the history
  • Loading branch information
xiepaup authored and iSecloud committed Dec 10, 2024
1 parent 1374003 commit 6aadf16
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@ import (
// RedisInstallParams 安装参数
type RedisInstallParams struct {
common.MediaPkg
DbToolsPkg common.DbToolsMediaPkg `json:"dbtoolspkg"`
RedisModulesPkg common.RedisModulesMediaPkg `json:"redis_modules_pkg"`
DataDirs []string `json:"data_dirs"`
IP string `json:"ip" validate:"required"`
Ports []int `json:"ports"` // 如果端口不连续,可直接指定端口
StartPort int `json:"start_port"` // 如果端口连续,则可直接指定起始端口和实例个数
InstNum int `json:"inst_num"`
Password string `json:"password" validate:"required"`
Databases int `json:"databases" validate:"required"`
RedisConfConfigs map[string]string `json:"redis_conf_configs" validate:"required"`
DbType string `json:"db_type" validate:"required"`
MaxMemory uint64 `json:"maxmemory"`
LoadModulesDetail []LoadModuleItem `json:"load_modules_detail"`
DbToolsPkg common.DbToolsMediaPkg `json:"dbtoolspkg"`
RedisModulesPkg common.RedisModulesMediaPkg `json:"redis_modules_pkg"`
DataDirs []string `json:"data_dirs"`
IP string `json:"ip" validate:"required"`
Ports []int `json:"ports"` // 如果端口不连续,可直接指定端口
StartPort int `json:"start_port"` // 如果端口连续,则可直接指定起始端口和实例个数
InstNum int `json:"inst_num"`
Password string `json:"password" validate:"required"`
Databases int `json:"databases" validate:"required"`
RedisConfConfigs map[string]string `json:"redis_conf_configs" validate:"required"`
DbType string `json:"db_type" validate:"required"`
// MaxMemory uint64 `json:"maxmemory"` //不要它了撒
LoadModulesDetail []LoadModuleItem `json:"load_modules_detail"`
}

// LoadModuleItem 加载module信息
Expand Down Expand Up @@ -539,7 +539,7 @@ func (job *RedisInstall) GenerateConfigFile(port int) (err error) {
confData = strings.ReplaceAll(confData, "{{redis_data_dir}}", instDir)
confData = strings.ReplaceAll(confData, "{{databases}}", strconv.Itoa(job.params.Databases))
confData = strings.ReplaceAll(confData, "{{cluster_enabled}}", clusterEnabled)
confData = strings.ReplaceAll(confData, "{{maxmemory}}", strconv.FormatUint(job.params.MaxMemory, 10))
confData = strings.ReplaceAll(confData, "{{maxmemory}}", "0")
confData = strings.ReplaceAll(confData, "{{rocks_blockcachemb}}", strconv.FormatUint(instBlockcache, 10))
confData = strings.ReplaceAll(confData, "{{rocks_write_buffer_size}}",
strconv.FormatUint(writeBufferSize, 10))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func (test *RedisInstallTest) SetMaxMemory(maxMemory uint64) *RedisInstallTest {
if test.Err != nil {
return test
}
test.MaxMemory = maxMemory
// test.MaxMemory = maxMemory
return test
}

Expand Down
2 changes: 1 addition & 1 deletion dbm-ui/backend/flow/utils/redis/redis_act_playload.py
Original file line number Diff line number Diff line change
Expand Up @@ -1404,7 +1404,7 @@ def get_redis_install_4_scene(self, **kwargs) -> dict:
# tendisplus cluster 模式暂时不需要特别指定这两个参数
if is_twemproxy_proxy_type(self.namespace):
install_payload["databases"] = int(redis_config["databases"])
install_payload["maxmemory"] = int(float(redis_config["maxmemory"]))
# install_payload["maxmemory"] = int(float(redis_config["maxmemory"])) ##不要它了,dbmon会动态的设置

return {
"db_type": DBActuatorTypeEnum.Redis.value,
Expand Down

0 comments on commit 6aadf16

Please sign in to comment.